Add checkpoints in PubsubNotifee

Since some of the methods in `PubsubNotifee` are doing nothing,
add checkpoints to yield control.
This commit is contained in:
mhchia 2020-02-04 17:44:10 +08:00
parent 66975ae3f2
commit 857bb34f4e
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A

View File

@ -32,10 +32,10 @@ class PubsubNotifee(INotifee):
self.dead_peers_queue = dead_peers_queue
async def opened_stream(self, network: INetwork, stream: INetStream) -> None:
...
await trio.hazmat.checkpoint()
async def closed_stream(self, network: INetwork, stream: INetStream) -> None:
...
await trio.hazmat.checkpoint()
async def connected(self, network: INetwork, conn: INetConn) -> None:
"""
@ -67,7 +67,7 @@ class PubsubNotifee(INotifee):
...
async def listen(self, network: INetwork, multiaddr: Multiaddr) -> None:
...
await trio.hazmat.checkpoint()
async def listen_close(self, network: INetwork, multiaddr: Multiaddr) -> None:
...
await trio.hazmat.checkpoint()