irc: Handle user disconnection
patch fd56f8eea3d9bba22d6597d934449795fb156101
Author: E. Bosch <presidev@AT@gmail.com>
Date: Fri Jan 29 01:24:25 CET 2021
* irc: Handle user disconnection
diff -rN -u old-irgramd/irc.py new-irgramd/irc.py
--- old-irgramd/irc.py 2024-11-23 02:32:46.770541187 +0100
+++ new-irgramd/irc.py 2024-11-23 02:32:46.770541187 +0100
@@ -50,7 +50,13 @@
self.logger.debug('Running client connection from %s', user.address)
while True:
- message = await user.stream.read_until(b'\n')
+ try:
+ message = await user.stream.read_until(b'\n')
+ except tornado.iostream.StreamClosedError:
+ if user in self.users.values():
+ del self.users[user.irc_nick]
+ del user
+ break
message = message.decode()
self.logger.debug(message)
matched = False
@@ -241,7 +247,7 @@
self.irc_nick = None
self.irc_username = None
self.irc_realname = None
- self.registered = True
+ self.registered = False
self.password = ''
self.recv_pass = ''