changeset 147:0aa31a2b9316

moved exception handling in IRC thread from process_data() to process_forever() where it belongs Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 17 Jan 2010 19:20:08 +0100
parents 229a59acde0f
children 484d8780bd34
files irclib.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/irclib.py
+++ b/irclib.py
@@ -207,12 +207,7 @@ class IRC:
                 if s == c._get_socket():
                     c.lock.acquire()
                     if hasattr(c, 'socket'):
-                        try:
-                            c.process_data()
-                        except ServerNotConnectedError:
-                            self.bot.restart()
-                        except:
-                            self.bot.error('[Error] Unkonwn exception on IRC thread:\n'+traceback.format_exc(), send_to_admins=True)
+                        c.process_data()
                     c.lock.release()
 
     def process_timeout(self):
@@ -259,7 +254,12 @@ class IRC:
             timeout -- Parameter to pass to process_once.
         """
         while 1:
-            self.process_once(timeout)
+            try:
+                self.process_once(timeout)
+            except ServerNotConnectedError:
+                self.bot.restart()
+            except:
+                self.bot.error('[Error] Unkonwn exception on IRC thread:\n'+traceback.format_exc(), send_to_admins=True)
 
     def disconnect_all(self, message=""):
         """Disconnects all connections."""