mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-16 03:21:22 +00:00
Remove tokio-codec dependency from multistream-select. (#1203)
* Remove tokio-codec dependency from multistream-select. In preparation for the eventual switch from tokio to std futures. Includes some initial refactoring in preparation for further work in the context of https://github.com/libp2p/rust-libp2p/issues/659. * Reduce default buffer sizes. * Allow more than one frame to be buffered for sending. * Doc tweaks. * Remove superfluous (duplicated) Message types.
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
//! # Multistream-select
|
||||
//!
|
||||
//! This crate implements the `multistream-select` protocol, which is the protocol used by libp2p
|
||||
//! to negotiate which protocol to use with the remote.
|
||||
//! to negotiate which protocol to use with the remote on a connection or substream.
|
||||
//!
|
||||
//! > **Note**: This crate is used by the internals of *libp2p*, and it is not required to
|
||||
//! > understand it in order to use *libp2p*.
|
||||
@ -76,6 +76,7 @@ mod protocol;
|
||||
|
||||
use futures::prelude::*;
|
||||
use std::io;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
pub use self::dialer_select::{dialer_select_proto, DialerSelectFuture};
|
||||
pub use self::error::ProtocolChoiceError;
|
||||
@ -93,9 +94,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<TInner> tokio_io::AsyncRead for Negotiated<TInner>
|
||||
impl<TInner> AsyncRead for Negotiated<TInner>
|
||||
where
|
||||
TInner: tokio_io::AsyncRead
|
||||
TInner: AsyncRead
|
||||
{
|
||||
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {
|
||||
self.0.prepare_uninitialized_buffer(buf)
|
||||
@ -119,9 +120,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<TInner> tokio_io::AsyncWrite for Negotiated<TInner>
|
||||
impl<TInner> AsyncWrite for Negotiated<TInner>
|
||||
where
|
||||
TInner: tokio_io::AsyncWrite
|
||||
TInner: AsyncWrite
|
||||
{
|
||||
fn shutdown(&mut self) -> Poll<(), io::Error> {
|
||||
self.0.shutdown()
|
||||
|
Reference in New Issue
Block a user