mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 09:41:34 +00:00
New core (#568)
* New core * Fix lifetime requirements * Remove identify transport * Address &mut & ref ref mut * Fix whitespaces
This commit is contained in:
@ -57,13 +57,12 @@ impl<F> Clone for SimpleProtocol<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, F, O, Maf> ConnectionUpgrade<C, Maf> for SimpleProtocol<F>
|
||||
impl<C, F, O> ConnectionUpgrade<C> for SimpleProtocol<F>
|
||||
where
|
||||
C: AsyncRead + AsyncWrite,
|
||||
F: Fn(C) -> O,
|
||||
O: IntoFuture<Error = IoError>,
|
||||
O::Future: Send + 'static,
|
||||
Maf: Send + 'static,
|
||||
{
|
||||
type NamesIter = iter::Once<(Bytes, ())>;
|
||||
type UpgradeIdentifier = ();
|
||||
@ -74,13 +73,12 @@ where
|
||||
}
|
||||
|
||||
type Output = O::Item;
|
||||
type MultiaddrFuture = Maf;
|
||||
type Future = Box<Future<Item = (O::Item, Self::MultiaddrFuture), Error = IoError> + Send>;
|
||||
type Future = Box<Future<Item = O::Item, Error = IoError> + Send>;
|
||||
|
||||
#[inline]
|
||||
fn upgrade(self, socket: C, _: (), _: Endpoint, client_addr: Maf) -> Self::Future {
|
||||
fn upgrade(self, socket: C, _: (), _: Endpoint) -> Self::Future {
|
||||
let upgrade = &self.upgrade;
|
||||
let fut = upgrade(socket).into_future().from_err().map(move |out| (out, client_addr));
|
||||
let fut = upgrade(socket).into_future().from_err();
|
||||
Box::new(fut) as Box<_>
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user