mirror of
https://github.com/codex-storage/nim-libp2p.git
synced 2025-02-09 09:33:25 +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.} =
|
proc dropFanoutPeers(g: GossipSub) {.async.} =
|
||||||
# drop peers that we haven't published to in
|
# drop peers that we haven't published to in
|
||||||
# GossipSubFanoutTTL seconds
|
# GossipSubFanoutTTL seconds
|
||||||
for topic in g.lastFanoutPubSub.keys:
|
var dropping = newSeq[string]()
|
||||||
if Moment.now > g.lastFanoutPubSub[topic]:
|
for topic, val in g.lastFanoutPubSub:
|
||||||
g.lastFanoutPubSub.del(topic)
|
if Moment.now > val:
|
||||||
|
dropping.add(topic)
|
||||||
g.fanout.del(topic)
|
g.fanout.del(topic)
|
||||||
|
for topic in dropping:
|
||||||
|
g.lastFanoutPubSub.del(topic)
|
||||||
|
|
||||||
proc getGossipPeers(g: GossipSub): Table[string, ControlMessage] {.gcsafe.} =
|
proc getGossipPeers(g: GossipSub): Table[string, ControlMessage] {.gcsafe.} =
|
||||||
## gossip iHave messages to peers
|
## gossip iHave messages to peers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user