From 823a67262ac8e206e205167ee4cb8fd3fac1a37a Mon Sep 17 00:00:00 2001 From: Eragon Date: Sat, 17 Dec 2022 13:30:29 +0100 Subject: [PATCH] I hope that this will fix the loop when the IRC is disconnected --- irc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/irc.py b/irc.py index fbf1ecf..55006f1 100644 --- a/irc.py +++ b/irc.py @@ -57,7 +57,10 @@ class IRC(object): self._send("QUIT :Bye bye") logging.debug("STOP: sent QUIT message") self.running = False - self._handler.join() + try: + self._handler.join() + except RuntimeError: + logging.error("STOP: Cannot join handler") logging.debug("STOP: thread has terminated") self._socket.close() logging.debug("STOP: socket close") @@ -113,6 +116,8 @@ class IRC(object): while self.running: # Get incoming messages data = self._socket.recv(4096).decode() + if data.__len__() == 0: + self.stop() # Split multiple lines for m in data.split('\r\n'):