fix(request-response): don't keep duplicate addresses#4700
fix(request-response): don't keep duplicate addresses#4700mergify[bot] merged 6 commits intolibp2p:masterfrom
Conversation
|
Nice one. This looks to have been a wee mem leak for us. We've been doing |
mxinden
left a comment
There was a problem hiding this comment.
How about using a HashSet instead?
modified protocols/request-response/src/lib.rs
@@ -337,7 +337,7 @@ where
/// reachable addresses, if any.
connected: HashMap<PeerId, SmallVec<[Connection; 2]>>,
/// Externally managed addresses via `add_address` and `remove_address`.
- addresses: HashMap<PeerId, SmallVec<[Multiaddr; 6]>>,
+ addresses: HashMap<PeerId, HashSet<Multiaddr>>,
/// Requests that have not yet been sent and are waiting for a connection
/// to be established.
pending_outbound_requests: HashMap<PeerId, SmallVec<[RequestProtocol<TCodec>; 10]>>,
+1 for using a |
This prevents us from adding duplicates into the list of peer addresses we have.
|
Thanks! Can you address the clippy failure? |
|
Fixed the clippy lint. Is v0.53.0 set to be released soon? Or, possibly, is there a patch release that this could part of soon? Thanks for all the work! |
If you backport it to the |
Description
Resolves: #4699.
Notes & open questions
In
kad, there is a specialAddressesstruct that might be worth reusing for this functionality.I will make further CHANGELOG edits etc if this fix is thought to be sensible.
Change checklist