mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-04 20:21:33 +00:00
feat(swarm): make stream uprade errors more ergonomic
The currently provided `ConnectionHandlerUpgrErr` is very hard to use. Not only does it have a long name, it also features 3 levels of nesting which results in a lot of boilerplate. Last but not least, it exposes `multistream-select` as a dependency to all protocols. We fix all of the above by renaming the type to `StreamUpgradeError` and flattening out its interface. Unrecoverable errors during protocol selection are hidden within the `Io` variant. Related: #3759. Pull-Request: #3882.
This commit is contained in:
@ -30,7 +30,7 @@ use libp2p_swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailu
|
||||
use libp2p_swarm::dial_opts::{self, DialOpts};
|
||||
use libp2p_swarm::{dummy, ConnectionDenied, ConnectionId, THandler, THandlerOutEvent};
|
||||
use libp2p_swarm::{
|
||||
ConnectionHandlerUpgrErr, ExternalAddresses, NetworkBehaviour, NotifyHandler, PollParameters,
|
||||
ExternalAddresses, NetworkBehaviour, NotifyHandler, PollParameters, StreamUpgradeError,
|
||||
THandlerInEvent, ToSwarm,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
@ -65,7 +65,7 @@ pub enum Error {
|
||||
#[error("Failed to dial peer.")]
|
||||
Dial,
|
||||
#[error("Failed to establish substream: {0}.")]
|
||||
Handler(ConnectionHandlerUpgrErr<Void>),
|
||||
Handler(StreamUpgradeError<Void>),
|
||||
}
|
||||
|
||||
pub struct Behaviour {
|
||||
|
Reference in New Issue
Block a user