Remove duplicate ports for connected nodes upon cleanup

This commit is contained in:
Dmitri Bogomolov 2021-05-15 20:24:18 +03:00
parent b2a7292d21
commit 3a06263f27
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -140,9 +140,22 @@ class singleCleaner(StoppableThread):
if state.thisapp.daemon or not state.enableGUI: if state.thisapp.daemon or not state.enableGUI:
os._exit(1) os._exit(1)
# inv/object tracking
for connection in BMConnectionPool().connections(): for connection in BMConnectionPool().connections():
connection.clean() connection.clean() # inv/object tracking
if not connection.fullyEstablished:
continue
self.logger.warning(
'Cleaning up duplicate ports for host %s',
connection.destination.host)
# remove peers with same host and other ports from knownnodes
for stream in connection.streams:
for node in [
node for node in knownnodes.knownNodes[stream]
if node.host == connection.destination.host
and node.port != connection.destination.port
]:
self.logger.warning('port %s', node.port)
del knownnodes.knownNodes[stream][node]
# discovery tracking # discovery tracking
exp = time.time() - singleCleaner.expireDiscoveredPeers exp = time.time() - singleCleaner.expireDiscoveredPeers