Remove Negotiated from upgrade traits (#1388)

* Remove Negotiated from upgrade traits

* Remove import
This commit is contained in:
Pierre Krieger
2020-01-13 14:34:43 +01:00
committed by GitHub
parent ff780b5bff
commit 42a45e2630
31 changed files with 218 additions and 220 deletions

View File

@ -31,7 +31,6 @@ use libp2p_core::{
InboundUpgrade,
OutboundUpgrade,
UpgradeInfo,
upgrade::Negotiated,
PeerId,
PublicKey,
};
@ -84,21 +83,21 @@ impl UpgradeInfo for PlainText1Config {
}
impl<C> InboundUpgrade<C> for PlainText1Config {
type Output = Negotiated<C>;
type Output = C;
type Error = Void;
type Future = Ready<Result<Negotiated<C>, Self::Error>>;
type Future = Ready<Result<C, Self::Error>>;
fn upgrade_inbound(self, i: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_inbound(self, i: C, _: Self::Info) -> Self::Future {
future::ready(Ok(i))
}
}
impl<C> OutboundUpgrade<C> for PlainText1Config {
type Output = Negotiated<C>;
type Output = C;
type Error = Void;
type Future = Ready<Result<Negotiated<C>, Self::Error>>;
type Future = Ready<Result<C, Self::Error>>;
fn upgrade_outbound(self, i: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_outbound(self, i: C, _: Self::Info) -> Self::Future {
future::ready(Ok(i))
}
}
@ -123,11 +122,11 @@ impl<C> InboundUpgrade<C> for PlainText2Config
where
C: AsyncRead + AsyncWrite + Send + Unpin + 'static
{
type Output = (PeerId, PlainTextOutput<Negotiated<C>>);
type Output = (PeerId, PlainTextOutput<C>);
type Error = PlainTextError;
type Future = BoxFuture<'static, Result<Self::Output, Self::Error>>;
fn upgrade_inbound(self, socket: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_inbound(self, socket: C, _: Self::Info) -> Self::Future {
Box::pin(self.handshake(socket))
}
}
@ -136,11 +135,11 @@ impl<C> OutboundUpgrade<C> for PlainText2Config
where
C: AsyncRead + AsyncWrite + Send + Unpin + 'static
{
type Output = (PeerId, PlainTextOutput<Negotiated<C>>);
type Output = (PeerId, PlainTextOutput<C>);
type Error = PlainTextError;
type Future = BoxFuture<'static, Result<Self::Output, Self::Error>>;
fn upgrade_outbound(self, socket: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_outbound(self, socket: C, _: Self::Info) -> Self::Future {
Box::pin(self.handshake(socket))
}
}