-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
util/network-devp2p/src/host.rs
Outdated
@@ -566,7 +574,7 @@ impl Host { | |||
self.connect_peer(&id, io); | |||
started += 1; | |||
} | |||
debug!(target: "network", "Connecting peers: {} sessions, {} pending, {} started", self.session_count(), self.handshake_count(), started); | |||
debug!(target: "network", "Connecting peers: {} sessions, {} pending, {} started", egress_count + ingress_count, self.handshake_count(), started); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not calling a variable handshake_count
? Calling a method initiates another iteration of session_count()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (and requires some thorough real-world testing, which I didn't do), except for that minor effectiveness issue.
Please don't forget to battle-test this on nightly before backporting to other release channels (which, I think, we should do eventually). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
@@ -707,12 +710,17 @@ impl Host { | |||
(info.config.min_peers as usize, max_peers as usize, info.config.non_reserved_mode == NonReservedPeerMode::Deny, info.id().clone()) | |||
}; | |||
|
|||
max_peers = max(max_peers, min_peers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? (assuming we validate in the config that max_peers >= min_peers
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just another sanity check, so that this code does not rely on config.
I'll test this tomorrow once I have a proper internet connection. |
This is working properly for me. |
@arkpar @andresilva I installed master on a boot node and only had about 11 peers after 30 minutes. When I reverted to 1.8.4 it got 18 peers straight away. Is there logs or debug info I can provide to you on this? BTW the node is running with these options:
|
* Limit ingress connections * Optimized handshakes logging
* Limit ingress connections * Optimized handshakes logging
* updater: apply exponential backoff after download failure (#8059) * updater: apply exponential backoff after download failure * updater: reset backoff on new release * Limit incoming connections. (#8060) * Limit ingress connections * Optimized handshakes logging * Max code size on Kovan (#8067) * Enable code size limit on kovan * Fix formatting. * add some dos protection (#8084) * more dos protection (#8104) * Const time comparison (#8113) * Use `subtle::slices_equal` for constant time comparison. Also update the existing version of subtle in `ethcrypto` from 0.1 to 0.5 * Test specifically for InvalidPassword error. * revert removing blooms (#8066) * Revert "fix traces, removed bloomchain crate, closes #7228, closes #7167" This reverts commit 1bf6203. * Revert "fixed broken logs (#7934)" This reverts commit f8a2e53. * fixed broken logs * bring back old lock order * remove migration v13 * revert CURRENT_VERSION to 12 in migration.rs * Fix compilation. * Check one step deeper if we're on release track branches * add missing pr * Fix blooms? * Fix tests compiilation. * Fix size.
* Limit ingress connections * Optimized handshakes logging
* Support parity protocol. (#8035) * updater: apply exponential backoff after download failure (#8059) * updater: apply exponential backoff after download failure * updater: reset backoff on new release * Max code size on Kovan (#8067) * Enable code size limit on kovan * Fix formatting. * Limit incoming connections. (#8060) * Limit ingress connections * Optimized handshakes logging * WASM libraries bump (#7970) * update wasmi, parity-wasm, wasm-utils to latest version * Update to new wasmi & error handling * also utilize new stack limiter * fix typo * replace dependency url * Cargo.lock update * add some dos protection (#8084) * revert removing blooms (#8066) * Revert "fix traces, removed bloomchain crate, closes #7228, closes #7167" This reverts commit 1bf6203. * Revert "fixed broken logs (#7934)" This reverts commit f8a2e53. * fixed broken logs * bring back old lock order * remove migration v13 * revert CURRENT_VERSION to 12 in migration.rs * more dos protection (#8104) * Const time comparison (#8113) * Use `subtle::slices_equal` for constant time comparison. Also update the existing version of subtle in `ethcrypto` from 0.1 to 0.5 * Test specifically for InvalidPassword error. * fix trace filter returning returning unrelated reward calls, closes #8070 (#8098) * network: init discovery using healthy nodes (#8061) * network: init discovery using healthy nodes * network: fix style grumble * network: fix typo * Postpone Kovan hard fork (#8137) * ethcore: postpone Kovan hard fork * util: update version fork metadata * Disable UI by default. (#8105) * dapps: update parity-ui dependencies (#8160)
This limits incoming connections to
max(max_peers - min_peers, min_peers / 2)
effectively reserving at least
min_peers / 2
connections to be outbound.Needs careful review and testing on a machine that can accept connections.