* New core

* Fix lifetime requirements

* Remove identify transport

* Address &mut & ref ref mut

* Fix whitespaces
This commit is contained in:
Pierre Krieger
2018-10-17 10:17:40 +01:00
committed by GitHub
parent 724d0f5d82
commit 5d1c54cc10
52 changed files with 849 additions and 1492 deletions

View File

@ -58,7 +58,7 @@
//!
//! let future = transport.dial("/ip4/127.0.0.1/tcp/12345".parse::<Multiaddr>().unwrap())
//! .unwrap_or_else(|_| panic!("Unable to dial node"))
//! .and_then(|(connection, _)| {
//! .and_then(|connection| {
//! // Sends "hello world" on the connection, will be encrypted.
//! write_all(connection, "hello world")
//! });
@ -349,14 +349,12 @@ where
pub ephemeral_public_key: Vec<u8>,
}
impl<S, Maf> libp2p_core::ConnectionUpgrade<S, Maf> for SecioConfig
impl<S> libp2p_core::ConnectionUpgrade<S> for SecioConfig
where
S: AsyncRead + AsyncWrite + Send + 'static, // TODO: 'static :(
Maf: Send + 'static, // TODO: 'static :(
{
type Output = SecioOutput<S>;
type MultiaddrFuture = Maf;
type Future = Box<Future<Item = (Self::Output, Maf), Error = IoError> + Send>;
type Future = Box<Future<Item = Self::Output, Error = IoError> + Send>;
type NamesIter = iter::Once<(Bytes, ())>;
type UpgradeIdentifier = ();
@ -371,7 +369,6 @@ where
incoming: S,
_: (),
_: libp2p_core::Endpoint,
remote_addr: Maf,
) -> Self::Future {
debug!("Starting secio upgrade");
@ -384,7 +381,7 @@ where
ephemeral_public_key: ephemeral,
}
}).map_err(map_err);
Box::new(wrapped.map(move |out| (out, remote_addr)))
Box::new(wrapped)
}
}