I hope that this will fix the loop when the IRC is disconnected
This commit is contained in:
parent
ffab42234e
commit
823a67262a
7
irc.py
7
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'):
|
||||
|
|
Loading…
Reference in New Issue