mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 08:41:36 +00:00
Update core, tcp, secio and mplex to futures-0.3. (#1302)
* Update `rw-stream-sink` to futures-0.3. * Update core, tcp, secio and mplex to futures-0.3. On top of https://github.com/libp2p/rust-libp2p/pull/1301
This commit is contained in:
committed by
Pierre Krieger
parent
cb74580e35
commit
f85241dd36
@ -115,7 +115,7 @@ pub async fn read_varint(socket: &mut (impl AsyncRead + Unpin)) -> Result<usize,
|
||||
/// > **Note**: Assumes that a variable-length prefix indicates the length of the message. This is
|
||||
/// > compatible with what `write_one` does.
|
||||
pub async fn read_one(socket: &mut (impl AsyncRead + Unpin), max_size: usize)
|
||||
-> Result<Vec<u8>, ReadOneError>
|
||||
-> Result<Vec<u8>, ReadOneError>
|
||||
{
|
||||
let len = read_varint(socket).await?;
|
||||
if len > max_size {
|
||||
@ -171,7 +171,6 @@ impl error::Error for ReadOneError {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::{self, Cursor};
|
||||
|
||||
#[test]
|
||||
fn write_one_works() {
|
||||
@ -181,7 +180,7 @@ mod tests {
|
||||
|
||||
let mut out = vec![0; 10_000];
|
||||
futures::executor::block_on(
|
||||
write_one(&mut Cursor::new(&mut out[..]), data.clone())
|
||||
write_one(&mut futures::io::Cursor::new(&mut out[..]), data.clone())
|
||||
).unwrap();
|
||||
|
||||
let (out_len, out_data) = unsigned_varint::decode::usize(&out).unwrap();
|
||||
|
Reference in New Issue
Block a user