dont probe and ignore bad peers
This commit is contained in:
parent
1aa4d9d585
commit
3fdadee87c
1 changed files with 5 additions and 0 deletions
|
@ -142,6 +142,8 @@ class IterativeFinder:
|
||||||
return not self.closest_peer or self.distance.is_closer(peer.node_id, self.closest_peer.node_id)
|
return not self.closest_peer or self.distance.is_closer(peer.node_id, self.closest_peer.node_id)
|
||||||
|
|
||||||
def _add_active(self, peer):
|
def _add_active(self, peer):
|
||||||
|
if self.peer_manager.peer_is_good(peer) is False:
|
||||||
|
return
|
||||||
if peer not in self.active and peer.node_id and peer.node_id != self.protocol.node_id:
|
if peer not in self.active and peer.node_id and peer.node_id != self.protocol.node_id:
|
||||||
self.active.add(peer)
|
self.active.add(peer)
|
||||||
if self._is_closer(peer):
|
if self._is_closer(peer):
|
||||||
|
@ -193,6 +195,9 @@ class IterativeFinder:
|
||||||
continue
|
continue
|
||||||
if origin_address == (self.protocol.external_ip, self.protocol.udp_port):
|
if origin_address == (self.protocol.external_ip, self.protocol.udp_port):
|
||||||
continue
|
continue
|
||||||
|
if self.peer_manager.peer_is_good(peer) is False:
|
||||||
|
self.active.discard(peer)
|
||||||
|
continue
|
||||||
self._schedule_probe(peer)
|
self._schedule_probe(peer)
|
||||||
added += 1
|
added += 1
|
||||||
log.debug("running %d probes for key %s", len(self.running_probes), self.key.hex()[:8])
|
log.debug("running %d probes for key %s", len(self.running_probes), self.key.hex()[:8])
|
||||||
|
|
Loading…
Reference in a new issue