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

@ -97,8 +97,13 @@ where
muxer: StreamMuxerBox,
handler: THandler,
substream_upgrade_protocol_override: Option<upgrade::Version>,
max_negotiating_inbound_streams: usize,
) -> Self {
let wrapped_handler = HandlerWrapper::new(handler, substream_upgrade_protocol_override);
let wrapped_handler = HandlerWrapper::new(
handler,
substream_upgrade_protocol_override,
max_negotiating_inbound_streams,
);
Connection {
muxing: Muxing::new(muxer),
handler: wrapped_handler,