Fix Mplex and Swarm

This commit is contained in:
mhchia
2019-11-29 19:09:56 +08:00
parent ec43c25b45
commit 1e600ea7e0
13 changed files with 232 additions and 122 deletions

View File

@ -206,8 +206,7 @@ class Swarm(INetwork, Service):
logger.debug("successfully opened connection to peer %s", peer_id)
# FIXME: This is a intentional barrier to prevent from the handler exiting and
# closing the connection.
event = trio.Event()
await event.wait()
await trio.sleep_forever()
try:
# Success
@ -240,7 +239,7 @@ class Swarm(INetwork, Service):
# await asyncio.gather(
# *[connection.close() for connection in self.connections.values()]
# )
self.manager.stop()
await self.manager.stop()
await self.manager.wait_finished()
logger.debug("swarm successfully closed")