summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-17 19:37:00 -0400
committerTest_User <hax@andrewyu.org>2024-06-17 19:37:00 -0400
commit74cf63cbbfdff606d010a95f31b39fd454b139cf (patch)
tree8e8672fb4113706f02ba495dee3c2385a5fba597
parentb1627de0341fde3f8e736cdc809d3297f9ff0cbe (diff)
downloadpy_coupserv-74cf63cbbfdff606d010a95f31b39fd454b139cf.tar.gz
py_coupserv-74cf63cbbfdff606d010a95f31b39fd454b139cf.zip
This is not lua
-rwxr-xr-xCoupServ.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/CoupServ.py b/CoupServ.py
index 2357e86..363ddc8 100755
--- a/CoupServ.py
+++ b/CoupServ.py
@@ -150,12 +150,16 @@ def read_and_send():
threading.Thread(target=read_and_send, daemon=True).start()
def detect_broken():
- while True:
- for key in servlist:
- if servlist[key].distance == 0:
- send(":"+config["sid"]+" PING "+config["sid"]+" :"+key)
- break
- time.sleep(15)
+ try:
+ while True:
+ for key in servlist:
+ if servlist[key]["distance"] == 1:
+ send(":"+config["sid"]+" PING "+config["sid"]+" :"+key)
+ break
+ time.sleep(15)
+ except exception as e:
+ s.close()
+ raise e
threading.Thread(target=detect_broken, daemon=True).start()