Update server.py
This commit is contained in:
parent
2730cfa6c5
commit
6c1a890670
1 changed files with 10 additions and 8 deletions
|
@ -66,11 +66,13 @@ def pinger(nick, connection):
|
|||
global property_list
|
||||
while nick in property_list:
|
||||
if (time.time() - property_list[nick]["last_ping"]) > 60 and not property_list[nick]["ping_pending"]:
|
||||
if nick in property_list:
|
||||
print("Sent ping message to " + nick)
|
||||
property_list[nick]["ping_pending"] = True
|
||||
time.sleep(0.5)
|
||||
connection.sendall(bytes(f"PING {server}\r\n","UTF-8"))
|
||||
elif property_list[nick]["ping_pending"] and ((time.time() - property_list[nick]["last_ping"]) > 255):
|
||||
if nick in property_list:
|
||||
property_list[nick]["cause"] = "Ping timeout: 255 seconds"
|
||||
connection.shutdown(socket.SHUT_WR)
|
||||
connection.close()
|
||||
|
|
Loading…
Reference in a new issue