Always accept incoming connections from trusted peers #7001
Labels
A-networking
Related to networking in general
C-enhancement
New feature or request
D-good-first-issue
Nice and easy! A great choice to get started
Describe the feature
currently we're always rejecting incoming connections if we're at capacity
reth/crates/net/network/src/peers/manager.rs
Lines 226 to 228 in e42fb32
this makes it impossible to accept connections from trusted peers
the problem is that we only get the peer id after negotiating the rlpx session
so we can't directly disconnect these connections as long as the ip is not banned:
reth/crates/net/network/src/swarm.rs
Lines 198 to 201 in e42fb32
reth/crates/net/network/src/session/mod.rs
Lines 313 to 318 in e42fb32
instead we need to establish them and then apply the capacity check here, if the peer is not trusted:
reth/crates/net/network/src/peers/manager.rs
Line 269 in e42fb32
the expected behaviour should mimic:
https://github.com/ethereum/go-ethereum/blob/b590cae89232299d54aac8aada88c66d00c5b34c/p2p/server.go#L817-L829
TODO
Additional context
No response
The text was updated successfully, but these errors were encountered: