* 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

@ -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<_>
}
}