From 1588be2be956e8c31219dfbf7adaa9d831b2315c Mon Sep 17 00:00:00 2001 From: mhchia Date: Fri, 31 Jan 2020 17:42:47 +0800 Subject: [PATCH] Change the channel size of peer queue Back to `0`, to avoid unlimited buffer size. --- libp2p/pubsub/pubsub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/pubsub/pubsub.py b/libp2p/pubsub/pubsub.py index 26c4b4ff..41cd9655 100644 --- a/libp2p/pubsub/pubsub.py +++ b/libp2p/pubsub/pubsub.py @@ -96,8 +96,8 @@ class Pubsub(Service, IPubsub): # Attach this new Pubsub object to the router self.router.attach(self) - peer_send, peer_receive = trio.open_memory_channel[ID](math.inf) - dead_peer_send, dead_peer_receive = trio.open_memory_channel[ID](math.inf) + peer_send, peer_receive = trio.open_memory_channel[ID](0) + dead_peer_send, dead_peer_receive = trio.open_memory_channel[ID](0) # Only keep the receive channels in `Pubsub`. # Therefore, we can only close from the receive side. self.peer_receive_channel = peer_receive