kopia lustrzana https://github.com/tayfunulu/WiFiManager
cleanup server socket and client close
rodzic
6b7e885bb0
commit
ff4ad2524a
|
@ -199,6 +199,7 @@ def stop():
|
|||
|
||||
if server_socket:
|
||||
server_socket.close()
|
||||
server_socket = None
|
||||
|
||||
|
||||
def start(port=80):
|
||||
|
@ -227,13 +228,12 @@ def start(port=80):
|
|||
while True:
|
||||
|
||||
if wlan_sta.isconnected():
|
||||
client.close
|
||||
return True
|
||||
|
||||
client, addr = server_socket.accept()
|
||||
client.settimeout(5.0)
|
||||
|
||||
print('client connected from', addr)
|
||||
try:
|
||||
client.settimeout(5.0)
|
||||
|
||||
request = b""
|
||||
try:
|
||||
|
@ -245,7 +245,6 @@ def start(port=80):
|
|||
print("Request is: {}".format(request))
|
||||
if "HTTP" not in request:
|
||||
# skip invalid requests
|
||||
client.close()
|
||||
continue
|
||||
|
||||
# version 1.9 compatibility
|
||||
|
@ -262,4 +261,5 @@ def start(port=80):
|
|||
else:
|
||||
handle_not_found(client, url)
|
||||
|
||||
finally:
|
||||
client.close()
|
||||
|
|
Ładowanie…
Reference in New Issue