# HG changeset patch # User Charly COSTE # Date 1267887461 -3600 # Node ID fb0cf6bf9eab9d6048667cc792df5d0d380deabf # Parent c4f058ee3f773401d40d4ee151b7f33374dd5d34 (irclib) moved ServerNotConnectedError handling from IRC.process_data() to IRC.process_forever() in order to always catch it Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -240,14 +240,7 @@ class IRC: if s == c._get_socket(): c.lock.acquire() if hasattr(c, 'socket'): - try: - c.process_data() - except ServerNotConnectedError: - if c.real_nickname == self.bot.nickname: - self.bot.restart(message='Lost bot IRC connection') - else: - c.disconnect(volontary=True) - c.connect() + c.process_data() c.lock.release() def process_timeout(self): @@ -300,7 +293,12 @@ class IRC: try: self.process_once(timeout) except ServerNotConnectedError: - self.bot.restart() + c = e.args[1] + if c.real_nickname == self.bot.nickname: + self.bot.restart(message='Lost bot IRC connection') + else: + c.disconnect(volontary=True) + c.connect() except: self.bot.error(say_levels.error, 'Unkonwn exception on IRC thread:\n'+traceback.format_exc(), send_to_admins=True)