Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(network): don't disconnect reserved peers (#9608)
Browse files Browse the repository at this point in the history
The priority of && and || was borked.
  • Loading branch information
ordian authored and 5chdn committed Sep 25, 2018
1 parent f416cc9 commit 525f2c8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions util/network-devp2p/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,14 @@ impl Host {
let max_ingress = max(max_peers - min_peers, min_peers / 2);
if reserved_only ||
(s.info.originated && egress_count > min_peers) ||
(!s.info.originated && ingress_count > max_ingress) && !self.reserved_nodes.read().contains(&id) {
// only proceed if the connecting peer is reserved.
s.disconnect(io, DisconnectReason::TooManyPeers);
kill = true;
break;
(!s.info.originated && ingress_count > max_ingress) {
if !self.reserved_nodes.read().contains(&id) {
// only proceed if the connecting peer is reserved.
trace!(target: "network", "Disconnecting non-reserved peer {:?}", id);
s.disconnect(io, DisconnectReason::TooManyPeers);
kill = true;
break;
}
}

if !self.filter.as_ref().map_or(true, |f| f.connection_allowed(&self_id, &id, ConnectionDirection::Inbound)) {
Expand Down

0 comments on commit 525f2c8

Please sign in to comment.