mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-30 16:31:57 +00:00
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:
@@ -167,9 +167,6 @@ impl Config {
|
||||
}
|
||||
|
||||
/// Configures the size of the LRU cache, caching addresses of discovered peers.
|
||||
///
|
||||
/// The [`Swarm`](libp2p_swarm::Swarm) may extend the set of addresses of an outgoing connection attempt via
|
||||
/// [`Behaviour::addresses_of_peer`].
|
||||
pub fn with_cache_size(mut self, cache_size: usize) -> Self {
|
||||
self.cache_size = cache_size;
|
||||
self
|
||||
|
@@ -47,7 +47,7 @@ pub struct Behaviour {
|
||||
|
||||
/// Hold addresses of all peers that we have discovered so far.
|
||||
///
|
||||
/// Storing these internally allows us to assist the [`libp2p_swarm::Swarm`] in dialing by returning addresses from [`NetworkBehaviour::addresses_of_peer`].
|
||||
/// Storing these internally allows us to assist the [`libp2p_swarm::Swarm`] in dialing by returning addresses from [`NetworkBehaviour::handle_pending_outbound_connection`].
|
||||
discovered_peers: HashMap<(PeerId, Namespace), Vec<Multiaddr>>,
|
||||
|
||||
/// Tracks the expiry of registrations that we have discovered and stored in `discovered_peers` otherwise we have a memory leak.
|
||||
|
@@ -417,7 +417,7 @@ where
|
||||
|
||||
/// Adds a known address for a peer that can be used for
|
||||
/// dialing attempts by the `Swarm`, i.e. is returned
|
||||
/// by [`NetworkBehaviour::addresses_of_peer`].
|
||||
/// by [`NetworkBehaviour::handle_pending_outbound_connection`].
|
||||
///
|
||||
/// Addresses added in this way are only removed by `remove_address`.
|
||||
pub fn add_address(&mut self, peer: &PeerId, address: Multiaddr) {
|
||||
|
Reference in New Issue
Block a user