Don't modify iterables while iterating them (#219)
* don't modify iterables while iterating * assert handlers to properly close connections
This commit is contained in:
parent
9cd47fe816
commit
7cb6c81159
|
@ -118,6 +118,7 @@ method handle*(m: Mplex) {.async, gcsafe.} =
|
|||
# doAssert(stream.closed, "connection not closed by handler!")
|
||||
except CatchableError as exc:
|
||||
trace "exception in stream handler", exc = exc.msg
|
||||
doAssert(stream.closed, "stream not closed by protocol handler")
|
||||
finally:
|
||||
m.conns.keepItIf(it != stream)
|
||||
m.handlerFuts.keepItIf(it != fut)
|
||||
|
|
|
@ -215,7 +215,7 @@ proc heartbeat(g: GossipSub) {.async.} =
|
|||
await g.heartbeatLock.acquire()
|
||||
trace "running heartbeat"
|
||||
|
||||
for t in g.topics.keys:
|
||||
for t in toSeq(g.topics.keys):
|
||||
await g.rebalanceMesh(t)
|
||||
|
||||
await g.dropFanoutPeers()
|
||||
|
|
Loading…
Reference in New Issue