8787 /// The configured override for substream protocol upgrades, if any.
8888 substream_upgrade_protocol_override : Option < libp2p_core:: upgrade:: Version > ,
8989
90+ /// The maximum number of inbound streams concurrently negotiating on a connection.
91+ ///
92+ /// See [`super::handler_wrapper::HandlerWrapper::max_negotiating_inbound_streams`].
93+ max_negotiating_inbound_streams : usize ,
94+
9095 /// The executor to use for running the background tasks. If `None`,
9196 /// the tasks are kept in `local_spawns` instead and polled on the
9297 /// current thread when the [`Pool`] is polled for new events.
@@ -263,6 +268,7 @@ where
263268 task_command_buffer_size : config. task_command_buffer_size ,
264269 dial_concurrency_factor : config. dial_concurrency_factor ,
265270 substream_upgrade_protocol_override : config. substream_upgrade_protocol_override ,
271+ max_negotiating_inbound_streams : config. max_negotiating_inbound_streams ,
266272 executor : config. executor ,
267273 local_spawns : FuturesUnordered :: new ( ) ,
268274 pending_connection_events_tx,
@@ -744,6 +750,7 @@ where
744750 muxer,
745751 handler. into_handler ( & obtained_peer_id, & endpoint) ,
746752 self . substream_upgrade_protocol_override ,
753+ self . max_negotiating_inbound_streams ,
747754 ) ;
748755 self . spawn (
749756 task:: new_for_established_connection (
@@ -1153,6 +1160,11 @@ pub struct PoolConfig {
11531160
11541161 /// The configured override for substream protocol upgrades, if any.
11551162 substream_upgrade_protocol_override : Option < libp2p_core:: upgrade:: Version > ,
1163+
1164+ /// The maximum number of inbound streams concurrently negotiating on a connection.
1165+ ///
1166+ /// See [super::handler_wrapper::HandlerWrapper::max_negotiating_inbound_streams].
1167+ max_negotiating_inbound_streams : usize ,
11561168}
11571169
11581170impl Default for PoolConfig {
@@ -1164,6 +1176,7 @@ impl Default for PoolConfig {
11641176 // By default, addresses of a single connection attempt are dialed in sequence.
11651177 dial_concurrency_factor : NonZeroU8 :: new ( 1 ) . expect ( "1 > 0" ) ,
11661178 substream_upgrade_protocol_override : None ,
1179+ max_negotiating_inbound_streams : 128 ,
11671180 }
11681181 }
11691182}
@@ -1222,6 +1235,14 @@ impl PoolConfig {
12221235 self . substream_upgrade_protocol_override = Some ( v) ;
12231236 self
12241237 }
1238+
1239+ /// The maximum number of inbound streams concurrently negotiating on a connection.
1240+ ///
1241+ /// See [`super::handler_wrapper::HandlerWrapper::max_negotiating_inbound_streams`].
1242+ pub fn with_max_negotiating_inbound_streams ( mut self , v : usize ) -> Self {
1243+ self . max_negotiating_inbound_streams = v;
1244+ self
1245+ }
12251246}
12261247
12271248trait EntryExt < ' a , K , V > {
0 commit comments