handle ping missed in lan connecting

This commit is contained in:
Kevin 2020-06-17 00:37:11 -05:00
parent 5b9bb2e5e2
commit 1f2c116b4b

View File

@ -37,9 +37,12 @@ def _lan_work(peer: LANIP):
break break
if identified_port.port != 0: if identified_port.port != 0:
break break
if requests.get(f'http://{peer}:{i}/ping') == 'pong!': try:
identified_port.port = i if requests.get(f'http://{peer}:{i}/ping') == 'onionr!':
break identified_port.port = i
break
except requests.exceptions.ConnectionError:
pass
Thread(target=find_port, args=[1024, 32767], daemon=True).start() Thread(target=find_port, args=[1024, 32767], daemon=True).start()
Thread(target=find_port, args=[32767, 65535], daemon=True).start() Thread(target=find_port, args=[32767, 65535], daemon=True).start()