Implement Send everywhere (#458)

This commit is contained in:
Pierre Krieger
2018-09-06 09:54:35 +02:00
committed by GitHub
parent bca1083d9c
commit ea1f172397
36 changed files with 367 additions and 232 deletions

View File

@ -59,9 +59,9 @@ use {SecioKeyPair, SecioKeyPairInner};
pub fn handshake<'a, S: 'a>(
socket: S,
local_key: SecioKeyPair,
) -> Box<Future<Item = (FullCodec<S>, PublicKey, Vec<u8>), Error = SecioError> + 'a>
) -> Box<Future<Item = (FullCodec<S>, PublicKey, Vec<u8>), Error = SecioError> + Send + 'a>
where
S: AsyncRead + AsyncWrite,
S: AsyncRead + AsyncWrite + Send,
{
// TODO: could be rewritten as a coroutine once coroutines land in stable Rust

View File

@ -289,12 +289,12 @@ where
impl<S, Maf> libp2p_core::ConnectionUpgrade<S, Maf> for SecioConfig
where
S: AsyncRead + AsyncWrite + 'static, // TODO: 'static :(
Maf: 'static, // TODO: 'static :(
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>>;
type Future = Box<Future<Item = (Self::Output, Maf), Error = IoError> + Send>;
type NamesIter = iter::Once<(Bytes, ())>;
type UpgradeIdentifier = ();
@ -342,7 +342,7 @@ pub struct SecioMiddleware<S> {
impl<S> SecioMiddleware<S>
where
S: AsyncRead + AsyncWrite,
S: AsyncRead + AsyncWrite + Send,
{
/// Attempts to perform a handshake on the given socket.
///
@ -351,7 +351,7 @@ where
pub fn handshake<'a>(
socket: S,
key_pair: SecioKeyPair,
) -> Box<Future<Item = (SecioMiddleware<S>, PublicKey, Vec<u8>), Error = SecioError> + 'a>
) -> Box<Future<Item = (SecioMiddleware<S>, PublicKey, Vec<u8>), Error = SecioError> + Send + 'a>
where
S: 'a,
{