Mercurial > xib
comparison irclib.py @ 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 |
comparison
equal
deleted
inserted
replaced
146:229a59acde0f | 147:0aa31a2b9316 |
---|---|
205 for s in sockets: | 205 for s in sockets: |
206 for c in self.connections: | 206 for c in self.connections: |
207 if s == c._get_socket(): | 207 if s == c._get_socket(): |
208 c.lock.acquire() | 208 c.lock.acquire() |
209 if hasattr(c, 'socket'): | 209 if hasattr(c, 'socket'): |
210 try: | 210 c.process_data() |
211 c.process_data() | |
212 except ServerNotConnectedError: | |
213 self.bot.restart() | |
214 except: | |
215 self.bot.error('[Error] Unkonwn exception on IRC thread:\n'+traceback.format_exc(), send_to_admins=True) | |
216 c.lock.release() | 211 c.lock.release() |
217 | 212 |
218 def process_timeout(self): | 213 def process_timeout(self): |
219 """Called when a timeout notification is due. | 214 """Called when a timeout notification is due. |
220 | 215 |
257 Arguments: | 252 Arguments: |
258 | 253 |
259 timeout -- Parameter to pass to process_once. | 254 timeout -- Parameter to pass to process_once. |
260 """ | 255 """ |
261 while 1: | 256 while 1: |
262 self.process_once(timeout) | 257 try: |
258 self.process_once(timeout) | |
259 except ServerNotConnectedError: | |
260 self.bot.restart() | |
261 except: | |
262 self.bot.error('[Error] Unkonwn exception on IRC thread:\n'+traceback.format_exc(), send_to_admins=True) | |
263 | 263 |
264 def disconnect_all(self, message=""): | 264 def disconnect_all(self, message=""): |
265 """Disconnects all connections.""" | 265 """Disconnects all connections.""" |
266 for c in self.connections: | 266 for c in self.connections: |
267 c.disconnect(message) | 267 c.disconnect(message) |