handle ping missed in lan connecting

This commit is contained in:
Kevin 2020-06-17 00:53:33 -05:00
parent c0b72f9007
commit bae8b38f08
2 changed files with 7 additions and 6 deletions

View File

@ -45,11 +45,12 @@ def _lan_work(peer: LANIP):
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
pass 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()
while identified_port.port == 0: #while identified_port.port == 0:
better_sleep(1) # better_sleep(1)
print(LANIP, identified_port.port) i = 1337
print(requests.get(f'http://{peer}:{i}/ping'))
def connect_peer(peer: LANIP): def connect_peer(peer: LANIP):

View File

@ -70,7 +70,7 @@ class LANServer:
return accept_upload(request) return accept_upload(request)
def start_server(self): def start_server(self):
self.server = WSGIServer((self.host, get_open_port()), self.server = WSGIServer((self.host, 1337),
self.app, log=None, self.app, log=None,
handler_class=FDSafeHandler) handler_class=FDSafeHandler)
self.port = self.server.server_port self.port = self.server.server_port