Add dead_peer_queue to pubsub

This commit is contained in:
NIC619
2019-11-04 14:22:24 +08:00
parent 3a0c7d06d1
commit c6c9393f2b
2 changed files with 14 additions and 2 deletions

View File

@ -60,6 +60,7 @@ class Pubsub:
router: "IPubsubRouter"
peer_queue: "asyncio.Queue[ID]"
dead_peer_queue: "asyncio.Queue[ID]"
protocols: List[TProtocol]
@ -100,7 +101,10 @@ class Pubsub:
# Register a notifee
self.peer_queue = asyncio.Queue()
self.host.get_network().register_notifee(PubsubNotifee(self.peer_queue))
self.dead_peer_queue = asyncio.Queue()
self.host.get_network().register_notifee(
PubsubNotifee(self.peer_queue, self.dead_peer_queue)
)
# Register stream handlers for each pubsub router protocol to handle
# the pubsub streams opened on those protocols