Skip to content

Commit

Permalink
protocols/kad: Limit # of inbound substreams to 32 (#2699)
Browse files Browse the repository at this point in the history
* protocols/kad/: Split into outbound and inbound substreams

* protocols/kad: Limit # of inbound substreams to 32

A remote node may still send more than 32 requests in parallel by using more
than one connection or by sending more than one request per stream.

* protocols/kad: Favor new substreams over old ones waiting for reuse

When a new inbound substream comes in and the limit of total inbound substreams
is hit, try to find an old inbound substream waiting to be reused. In such case,
replace the old with the new. In case no such old substream exists, drop the new
one.
  • Loading branch information
mxinden committed Jun 9, 2022
1 parent 0d3787e commit 5cb4886
Show file tree
Hide file tree
Showing 3 changed files with 334 additions and 171 deletions.
6 changes: 6 additions & 0 deletions protocols/kad/CHANGELOG.md
@@ -1,3 +1,9 @@
# 0.37.1 - unreleased

- Limit # of inbound streams to 32. [See PR 2699].

[PR 2699]: https://github.com/libp2p/rust-libp2p/pull/2699

# 0.37.0

- Update to `libp2p-core` `v0.33.0`.
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-kad"
edition = "2021"
rust-version = "1.56.1"
description = "Kademlia protocol for libp2p"
version = "0.37.0"
version = "0.37.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down

0 comments on commit 5cb4886

Please sign in to comment.