feat(swarm): remove deprecated IntoConnectionHandler

This removes the deprecated `IntoConnectionHandler` trait and all its implementations. Consequently, `NetworkBehaviour::new_handler` and `NetworkBehaviour::addresses_of_peer` are now gone and the two `handle_` functions are now required to implement.

Related: #3647.

Pull-Request: #3884.
This commit is contained in:
Thomas Eizinger
2023-05-08 10:30:29 +02:00
committed by GitHub
parent b4e724dd72
commit 0e36c7c072
15 changed files with 38 additions and 371 deletions

View File

@ -121,12 +121,9 @@ pub use behaviour::{
pub use connection::pool::{ConnectionCounters, ConnectionLimits};
pub use connection::{ConnectionError, ConnectionId};
pub use executor::Executor;
#[allow(deprecated)]
pub use handler::IntoConnectionHandler;
pub use handler::{
ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerSelect, ConnectionHandlerUpgrErr,
IntoConnectionHandlerSelect, KeepAlive, OneShotHandler, OneShotHandlerConfig,
SubstreamProtocol,
KeepAlive, OneShotHandler, OneShotHandlerConfig, SubstreamProtocol,
};
#[cfg(feature = "macros")]
pub use libp2p_swarm_derive::NetworkBehaviour;
@ -174,8 +171,7 @@ type TBehaviourOutEvent<TBehaviour> = <TBehaviour as NetworkBehaviour>::OutEvent
/// [`ConnectionHandler`] of the [`NetworkBehaviour`] for all the protocols the [`NetworkBehaviour`]
/// supports.
#[allow(deprecated)]
pub type THandler<TBehaviour> =
<<TBehaviour as NetworkBehaviour>::ConnectionHandler as IntoConnectionHandler>::Handler;
pub type THandler<TBehaviour> = <TBehaviour as NetworkBehaviour>::ConnectionHandler;
/// Custom event that can be received by the [`ConnectionHandler`] of the
/// [`NetworkBehaviour`].
@ -1681,8 +1677,7 @@ pub enum DialError {
LocalPeerId {
endpoint: ConnectedPoint,
},
/// [`NetworkBehaviour::addresses_of_peer`] returned no addresses
/// for the peer to dial.
/// No addresses have been provided by [`NetworkBehaviour::handle_pending_outbound_connection`] and [`DialOpts`].
NoAddresses,
/// The provided [`dial_opts::PeerCondition`] evaluated to false and thus
/// the dial was aborted.