mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 01:21:21 +00:00
Wrap multistream-select streams under a Negotiated (#1001)
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
use futures::future::{self, FutureResult};
|
||||
use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
||||
use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, upgrade::Negotiated};
|
||||
use std::iter;
|
||||
use void::Void;
|
||||
|
||||
@ -36,21 +36,21 @@ impl UpgradeInfo for PlainTextConfig {
|
||||
}
|
||||
|
||||
impl<C> InboundUpgrade<C> for PlainTextConfig {
|
||||
type Output = C;
|
||||
type Output = Negotiated<C>;
|
||||
type Error = Void;
|
||||
type Future = FutureResult<C, Self::Error>;
|
||||
type Future = FutureResult<Negotiated<C>, Self::Error>;
|
||||
|
||||
fn upgrade_inbound(self, i: C, _: Self::Info) -> Self::Future {
|
||||
fn upgrade_inbound(self, i: Negotiated<C>, _: Self::Info) -> Self::Future {
|
||||
future::ok(i)
|
||||
}
|
||||
}
|
||||
|
||||
impl<C> OutboundUpgrade<C> for PlainTextConfig {
|
||||
type Output = C;
|
||||
type Output = Negotiated<C>;
|
||||
type Error = Void;
|
||||
type Future = FutureResult<C, Self::Error>;
|
||||
type Future = FutureResult<Negotiated<C>, Self::Error>;
|
||||
|
||||
fn upgrade_outbound(self, i: C, _: Self::Info) -> Self::Future {
|
||||
fn upgrade_outbound(self, i: Negotiated<C>, _: Self::Info) -> Self::Future {
|
||||
future::ok(i)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user