mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 01:31:33 +00:00
Use tokio-codec. (#271)
This commit is contained in:
@ -86,6 +86,7 @@ extern crate log;
|
||||
extern crate multistream_select;
|
||||
extern crate parking_lot;
|
||||
extern crate rand;
|
||||
extern crate tokio_codec;
|
||||
extern crate tokio_io;
|
||||
|
||||
use bytes::{BufMut, Bytes, BytesMut};
|
||||
@ -101,7 +102,7 @@ use std::error::Error;
|
||||
use std::io::Error as IoError;
|
||||
use std::iter;
|
||||
use std::sync::Arc;
|
||||
use tokio_io::codec::{Decoder, Encoder};
|
||||
use tokio_codec::{Decoder, Encoder, Framed};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
/// Represents a prototype for an upgrade to handle the ping protocol.
|
||||
@ -160,8 +161,7 @@ where
|
||||
// TODO: can't figure out how to make it work without using an Arc/Mutex
|
||||
let expected_pongs = Arc::new(Mutex::new(HashMap::with_capacity(4)));
|
||||
|
||||
let sink_stream = socket
|
||||
.framed(Codec)
|
||||
let sink_stream = Framed::new(socket, Codec)
|
||||
.map(|msg| Message::Received(msg.freeze()));
|
||||
let (sink, stream) = sink_stream.split();
|
||||
|
||||
|
Reference in New Issue
Block a user