mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 09:31:20 +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:
@ -37,8 +37,8 @@ use libp2p_swarm::handler::{
|
||||
ListenUpgradeError,
|
||||
};
|
||||
use libp2p_swarm::{
|
||||
ConnectionHandler, ConnectionHandlerEvent, ConnectionId, KeepAlive, NegotiatedSubstream,
|
||||
StreamUpgradeError, SubstreamProtocol,
|
||||
ConnectionHandler, ConnectionHandlerEvent, ConnectionId, KeepAlive, Stream, StreamUpgradeError,
|
||||
SubstreamProtocol,
|
||||
};
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
@ -77,7 +77,7 @@ pub enum In {
|
||||
dst_peer_id: PeerId,
|
||||
inbound_circuit_req: inbound_hop::CircuitReq,
|
||||
dst_handler_notifier: oneshot::Sender<()>,
|
||||
dst_stream: NegotiatedSubstream,
|
||||
dst_stream: Stream,
|
||||
dst_pending_data: Bytes,
|
||||
},
|
||||
}
|
||||
@ -193,7 +193,7 @@ pub enum Event {
|
||||
src_connection_id: ConnectionId,
|
||||
inbound_circuit_req: inbound_hop::CircuitReq,
|
||||
dst_handler_notifier: oneshot::Sender<()>,
|
||||
dst_stream: NegotiatedSubstream,
|
||||
dst_stream: Stream,
|
||||
dst_pending_data: Bytes,
|
||||
},
|
||||
/// Negotiating an outbound substream for an inbound circuit request failed.
|
||||
@ -914,10 +914,10 @@ pub struct OutboundOpenInfo {
|
||||
|
||||
pub(crate) struct CircuitParts {
|
||||
circuit_id: CircuitId,
|
||||
src_stream: NegotiatedSubstream,
|
||||
src_stream: Stream,
|
||||
src_pending_data: Bytes,
|
||||
dst_peer_id: PeerId,
|
||||
dst_handler_notifier: oneshot::Sender<()>,
|
||||
dst_stream: NegotiatedSubstream,
|
||||
dst_stream: Stream,
|
||||
dst_pending_data: Bytes,
|
||||
}
|
||||
|
Reference in New Issue
Block a user