WIP: Handle all peers nonces, not only own #5
|
@ -380,10 +380,16 @@ class ConnectionBase(threading.Thread):
|
||||||
if (
|
if (
|
||||||
version.protocol_version != shared.protocol_version
|
version.protocol_version != shared.protocol_version
|
||||||
or version.nonce == shared.nonce
|
or version.nonce == shared.nonce
|
||||||
|
or version.nonce in shared.nonce_pool.values()
|
||||||
):
|
):
|
||||||
|
logging.warning(
|
||||||
|
'Disconnecting v%s node %s with nonce %s',
|
||||||
|
version.protocol_version, self.host_print,
|
||||||
|
base64.b16encode(version.nonce))
|
||||||
self.status = 'disconnecting'
|
self.status = 'disconnecting'
|
||||||
self.send_queue.put(None)
|
self.send_queue.put(None)
|
||||||
else:
|
else:
|
||||||
|
shared.nonce_pool[self.host] = version.nonce
|
||||||
logging.info(
|
logging.info(
|
||||||
'%s:%s claims to be %s',
|
'%s:%s claims to be %s',
|
||||||
self.host_print, self.port, version.user_agent)
|
self.host_print, self.port, version.user_agent)
|
||||||
|
|
|
@ -106,6 +106,10 @@ class Manager(threading.Thread):
|
||||||
if not c.is_alive() or c.status == 'disconnected':
|
if not c.is_alive() or c.status == 'disconnected':
|
||||||
with shared.connections_lock:
|
with shared.connections_lock:
|
||||||
shared.connections.remove(c)
|
shared.connections.remove(c)
|
||||||
|
try:
|
||||||
|
del shared.nonce_pool[c.host]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
hosts.add(structure.NetAddrNoPrefix.network_group(c.host))
|
hosts.add(structure.NetAddrNoPrefix.network_group(c.host))
|
||||||
if not c.server:
|
if not c.server:
|
||||||
|
|
|
@ -54,6 +54,7 @@ core_nodes = set()
|
||||||
|
|
||||||
node_pool = set()
|
node_pool = set()
|
||||||
unchecked_node_pool = set()
|
unchecked_node_pool = set()
|
||||||
|
nonce_pool = {}
|
||||||
|
|
||||||
i2p_core_nodes = set()
|
i2p_core_nodes = set()
|
||||||
i2p_node_pool = set()
|
i2p_node_pool = set()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user