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!")
|
# doAssert(stream.closed, "connection not closed by handler!")
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
trace "exception in stream handler", exc = exc.msg
|
trace "exception in stream handler", exc = exc.msg
|
||||||
|
doAssert(stream.closed, "stream not closed by protocol handler")
|
||||||
finally:
|
finally:
|
||||||
m.conns.keepItIf(it != stream)
|
m.conns.keepItIf(it != stream)
|
||||||
m.handlerFuts.keepItIf(it != fut)
|
m.handlerFuts.keepItIf(it != fut)
|
||||||
|
|
|
@ -215,7 +215,7 @@ proc heartbeat(g: GossipSub) {.async.} =
|
||||||
await g.heartbeatLock.acquire()
|
await g.heartbeatLock.acquire()
|
||||||
trace "running heartbeat"
|
trace "running heartbeat"
|
||||||
|
|
||||||
for t in g.topics.keys:
|
for t in toSeq(g.topics.keys):
|
||||||
await g.rebalanceMesh(t)
|
await g.rebalanceMesh(t)
|
||||||
|
|
||||||
await g.dropFanoutPeers()
|
await g.dropFanoutPeers()
|
||||||
|
|
Loading…
Reference in New Issue