Uh oh!
There was an error while loading. Please reload this page.
Limit number of incoming connections - #391
Conversation
| if self.reserved_only.load(atomic::Ordering::Relaxed) || | ||
| num_open_connections >= self.max_peers | ||
| num_open_connections.total >= self.max_peers || | ||
| num_open_connections.incoming >= self.max_incoming_peers |
There was a problem hiding this comment.
This code is also reached when we dial. You should use endpoint to determine whether we are dialing or listening.
tomaka
commented
Jul 20, 2018
We already limit the number of outgoing connections to |
sorpaas
commented
Jul 20, 2018
Tried a fix for the "never reaching
|
| /// Returns the number of new outgoing custom connections to peers to | ||
| /// open. This takes into account the number of active peers. | ||
| pub fn should_open_outgoing_custom_connections(&self) -> u32 { | ||
| use std::cmp::max; |
| min_peers: 25, | ||
| max_peers: 50, | ||
| max_incoming_peers_factor: 3, | ||
| incoming_peers_factor: 3, |
There was a problem hiding this comment.
I feel like 3 is too high, especially for bootstrap nodes which probably want 90% of incoming connections.
There was a problem hiding this comment.
And just for information, was choosing 3 because it comes from the eclipse attack paper.
gavofyork
commented
Jul 24, 2018
@tomaka better? |
tomaka
commented
Jul 24, 2018
sorpaas
commented
Jul 25, 2018
sorpaas
commented
Jul 25, 2018
And just wonder, what are the reasons that we use |
sorpaas
commented
Jul 25, 2018
Ah I see, from my understanding, looks like we need it for some cases in wasm. |
* master: (86 commits) Make contract a separate runtime module (#345) Version bump (#450) DB-based blockchain data cache for light nodes (#251) Update libp2p again (#445) Update version on git head change (#444) Fix the public key of bootnode 3 (#441) Update libp2p (#442) Switch to the master branch of libp2p (#427) Export ws port 9944 and add doc (#440) Iterate over overlay to decide which keys to purge (#436) Exit signal gets its own trait (#433) Add docker image (#375) Reset peers.json if the content is not loadable (#405) Limit number of incoming connections (#391) Fix memory leaks in libp2p (#432) Do not queue empty blocks set for import (#431) 5 random fixes (#1) (#435) Chore: fix typo (#434) Prevent building invalid blocks (#430) Better logging for public key mismatch (#429) ...
* Refactored Spot and Test
Fix#331
Add
max_incoming_peers, which is calculated from configmax_peers / max_incoming_peers_factor. Limit the number of incoming peers to be below this number.