mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-01-13 10:16:08 +00:00
Fix table assertion, edited while iterating
(the fix is not so nice.. adds plenty of allocations, but for now should be ok)
This commit is contained in:
parent
e39bf0a4cf
commit
3514733060
@ -298,10 +298,13 @@ proc rebalanceMesh(g: GossipSub, topic: string) {.async.} =
|
||||
proc dropFanoutPeers(g: GossipSub) {.async.} =
|
||||
# drop peers that we haven't published to in
|
||||
# GossipSubFanoutTTL seconds
|
||||
for topic in g.lastFanoutPubSub.keys:
|
||||
if Moment.now > g.lastFanoutPubSub[topic]:
|
||||
g.lastFanoutPubSub.del(topic)
|
||||
var dropping = newSeq[string]()
|
||||
for topic, val in g.lastFanoutPubSub:
|
||||
if Moment.now > val:
|
||||
dropping.add(topic)
|
||||
g.fanout.del(topic)
|
||||
for topic in dropping:
|
||||
g.lastFanoutPubSub.del(topic)
|
||||
|
||||
proc getGossipPeers(g: GossipSub): Table[string, ControlMessage] {.gcsafe.} =
|
||||
## gossip iHave messages to peers
|
||||
|
Loading…
x
Reference in New Issue
Block a user