From 87be0b34bcb1203d7d1eb32a0535960546194a70 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 2 Dec 2022 13:04:35 +1100 Subject: [PATCH] Don't use `task_event_buffer_size` for pending connections The task for a pending connection only ever sends one event into this channel: Either a success or a failure. Cloning a sender adds one slot to the capacity of the channel. Hence, we can start this capacity at 0 and have the `cloning` of the `Sender` take care of properly increasing the capacity. --- swarm/src/connection/pool.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swarm/src/connection/pool.rs b/swarm/src/connection/pool.rs index 8729b2e36e1..6ee085989d4 100644 --- a/swarm/src/connection/pool.rs +++ b/swarm/src/connection/pool.rs @@ -314,8 +314,7 @@ where { /// Creates a new empty `Pool`. pub fn new(local_id: PeerId, config: PoolConfig, limits: ConnectionLimits) -> Self { - let (pending_connection_events_tx, pending_connection_events_rx) = - mpsc::channel(config.task_event_buffer_size); + let (pending_connection_events_tx, pending_connection_events_rx) = mpsc::channel(0); let (established_connection_events_tx, established_connection_events_rx) = mpsc::channel(config.task_event_buffer_size); let executor = match config.executor {