mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 14:47:55 +00:00
Don't remove addresses from known_external_addresses (#8778)
* Don't remove addresses from known_external_addresses * Remove `remove`
This commit is contained in:
@@ -71,7 +71,7 @@ use sp_core::hexdisplay::HexDisplay;
|
||||
/// Maximum number of known external addresses that we will cache.
|
||||
/// This only affects whether we will log whenever we (re-)discover
|
||||
/// a given address.
|
||||
const MAX_KNOWN_EXTERNAL_ADDRESSES: usize = 64;
|
||||
const MAX_KNOWN_EXTERNAL_ADDRESSES: usize = 32;
|
||||
|
||||
/// `DiscoveryBehaviour` configuration.
|
||||
///
|
||||
@@ -574,9 +574,8 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
}
|
||||
|
||||
fn inject_expired_external_addr(&mut self, addr: &Multiaddr) {
|
||||
let with_peer_id = addr.clone()
|
||||
.with(Protocol::P2p(self.local_peer_id.clone().into()));
|
||||
self.known_external_addresses.remove(&with_peer_id);
|
||||
// We intentionally don't remove the element from `known_external_addresses` in order
|
||||
// to not print the log line again.
|
||||
|
||||
for k in self.kademlias.values_mut() {
|
||||
NetworkBehaviour::inject_expired_external_addr(k, addr)
|
||||
|
||||
@@ -59,11 +59,6 @@ impl<T: Hash + Eq> LruHashSet<T> {
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// Removes an element from the set if it is present.
|
||||
pub fn remove(&mut self, e: &T) -> bool {
|
||||
self.set.remove(e)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user