mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-03 11:41:34 +00:00
feat(swarm): deprecate NegotiatedSubstream
in favor of Stream
This patch tackles two things at once that are fairly intertwined: 1. There is no such thing as a "substream" in libp2p, the spec and other implementations only talk about "streams". We fix this by deprecating `NegotiatedSubstream`. 2. Previously, `NegotiatedSubstream` was a type alias that pointed to a type from `multistream-select`, effectively leaking the version of `multistream-select` to all dependencies of `libp2p-swarm`. We fix this by introducing a `Stream` newtype. Resolves: #3759. Related: #3748. Pull-Request: #3912.
This commit is contained in:
@ -27,7 +27,7 @@ use crate::handler::{
|
||||
SubstreamProtocol,
|
||||
};
|
||||
use crate::upgrade::{InboundUpgradeSend, OutboundUpgradeSend, UpgradeInfoSend};
|
||||
use crate::NegotiatedSubstream;
|
||||
use crate::Stream;
|
||||
use futures::{future::BoxFuture, prelude::*};
|
||||
use rand::Rng;
|
||||
use std::{
|
||||
@ -373,7 +373,7 @@ where
|
||||
type Error = (K, <H as InboundUpgradeSend>::Error);
|
||||
type Future = BoxFuture<'static, Result<Self::Output, Self::Error>>;
|
||||
|
||||
fn upgrade_inbound(mut self, resource: NegotiatedSubstream, info: Self::Info) -> Self::Future {
|
||||
fn upgrade_inbound(mut self, resource: Stream, info: Self::Info) -> Self::Future {
|
||||
let IndexedProtoName(index, info) = info;
|
||||
let (key, upgrade) = self.upgrades.remove(index);
|
||||
upgrade
|
||||
@ -395,7 +395,7 @@ where
|
||||
type Error = (K, <H as OutboundUpgradeSend>::Error);
|
||||
type Future = BoxFuture<'static, Result<Self::Output, Self::Error>>;
|
||||
|
||||
fn upgrade_outbound(mut self, resource: NegotiatedSubstream, info: Self::Info) -> Self::Future {
|
||||
fn upgrade_outbound(mut self, resource: Stream, info: Self::Info) -> Self::Future {
|
||||
let IndexedProtoName(index, info) = info;
|
||||
let (key, upgrade) = self.upgrades.remove(index);
|
||||
upgrade
|
||||
|
Reference in New Issue
Block a user