Skip to content

Commit

Permalink
refactor(swarm): don't use task_event_buffer_size for pending conne…
Browse files Browse the repository at this point in the history
…ctions (#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.
  • Loading branch information
thomaseizinger authored Dec 14, 2022
1 parent d79c93a commit 15ad798
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions swarm/src/connection/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 15ad798

Please sign in to comment.