From 5cbf2eb9177f007f32a39ae6f5324a9e984b5bfe Mon Sep 17 00:00:00 2001 From: Dpeta Date: Wed, 2 Nov 2022 03:32:06 +0100 Subject: [PATCH] Check if relevant variables are not None before ping --- pesterchum.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pesterchum.py b/pesterchum.py index 7cb2fd3..da5f18a 100755 --- a/pesterchum.py +++ b/pesterchum.py @@ -1710,6 +1710,11 @@ class PesterWindow(MovingWindow): self.sincerecv = 0 return + # We have IRC but we're missing a variable? + # gweh.jpg + if None in [self.lastCheckPing, self.sincerecv]: + return + # Desync check, happens if pc comes out of sleep. currentTime = time.time() timeDif = abs(currentTime - self.lastCheckPing) @@ -1722,7 +1727,7 @@ class PesterWindow(MovingWindow): ) % (timeDif, currentTime, self.lastCheckPing) ) - self.sincerecv = 85 # Allows one more ping attempt before disconnect. + self.sincerecv = 80 # Allows 2 more ping attempts before disconnect. self.lastCheckPing = time.time() # Presume connection is dead after 90 seconds of silence.