fix(network): don't disconnect reserved peers (#9608)
The priority of && and || was borked.
This commit is contained in:
parent
5a1dc3eb8a
commit
c4af7464e5
@ -751,11 +751,14 @@ impl Host {
|
|||||||
let max_ingress = max(max_peers - min_peers, min_peers / 2);
|
let max_ingress = max(max_peers - min_peers, min_peers / 2);
|
||||||
if reserved_only ||
|
if reserved_only ||
|
||||||
(s.info.originated && egress_count > min_peers) ||
|
(s.info.originated && egress_count > min_peers) ||
|
||||||
(!s.info.originated && ingress_count > max_ingress) && !self.reserved_nodes.read().contains(&id) {
|
(!s.info.originated && ingress_count > max_ingress) {
|
||||||
// only proceed if the connecting peer is reserved.
|
if !self.reserved_nodes.read().contains(&id) {
|
||||||
s.disconnect(io, DisconnectReason::TooManyPeers);
|
// only proceed if the connecting peer is reserved.
|
||||||
kill = true;
|
trace!(target: "network", "Disconnecting non-reserved peer {:?}", id);
|
||||||
break;
|
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)) {
|
if !self.filter.as_ref().map_or(true, |f| f.connection_allowed(&self_id, &id, ConnectionDirection::Inbound)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user