Skip to content

Commit e16e444

Browse files
committed
fix mem-leak on topic peers
Signed-off-by: onur-ozkan <[email protected]>
1 parent 6fc061b commit e16e444

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

protocols/gossipsub/src/behaviour.rs

+5
Original file line numberDiff line numberDiff line change
@@ -3337,6 +3337,11 @@ where
33373337
// support the protocol.
33383338
self.peer_topics.remove(&peer_id);
33393339

3340+
self.topic_peers.retain(|_, peers| {
3341+
peers.remove(&peer_id);
3342+
!peers.is_empty()
3343+
});
3344+
33403345
// If metrics are enabled, register the disconnection of a peer based on its protocol.
33413346
if let Some(metrics) = self.metrics.as_mut() {
33423347
let peer_kind = &self

0 commit comments

Comments
 (0)