Fix:
Force context switch before canceling swarm connection tasks
This commit is contained in:
parent
a8d9536b08
commit
97b3aca535
|
@ -43,6 +43,9 @@ class SwarmConn(INetConn):
|
||||||
# We *could* optimize this but it really isn't worth it.
|
# We *could* optimize this but it really isn't worth it.
|
||||||
for stream in self.streams:
|
for stream in self.streams:
|
||||||
await stream.reset()
|
await stream.reset()
|
||||||
|
# Force context switch for stream handlers to process the stream reset event we just emit
|
||||||
|
# before we cancel the stream handler tasks.
|
||||||
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
for task in self._tasks:
|
for task in self._tasks:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user