swarm/: Limit negotiating inbound substreams per connection (#2697)

This limit is shared across all `ConnectionHandler`s on a single connection. It
only enforces a limit on the number of negotiating substreams. Once negotiated a
`ConnectionHandler` manages the lifecycle of the substream and has to enforce
limits themselves.
This commit is contained in:
Max Inden
2022-06-08 11:48:46 +02:00
committed by GitHub
parent 59a74b4083
commit 2acbb457cd
6 changed files with 62 additions and 2 deletions

View File

@ -1364,6 +1364,14 @@ where
self
}
/// The maximum number of inbound streams concurrently negotiating on a connection.
///
/// See [`PoolConfig::with_max_negotiating_inbound_streams`].
pub fn max_negotiating_inbound_streams(mut self, v: usize) -> Self {
self.pool_config = self.pool_config.with_max_negotiating_inbound_streams(v);
self
}
/// Builds a `Swarm` with the current configuration.
pub fn build(mut self) -> Swarm<TBehaviour> {
let supported_protocols = self