refactor(swarm): don't use task_event_buffer_size for pending connections (#3187)

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.
This commit is contained in:
Thomas Eizinger
2022-12-15 03:50:06 +11:00
committed by GitHub
parent d79c93abdb
commit 15ad7987f2

View File

@ -319,8 +319,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 {