Mercurial > xib
comparison irclib.py @ 204:6388579c701d
auto-reconnect in irclib, restart if bot's IRC connection was lost
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Fri, 26 Feb 2010 20:59:20 +0100 |
parents | 4011838e098e |
children | 1cae0d82501b |
comparison
equal
deleted
inserted
replaced
203:2a81c480439a | 204:6388579c701d |
---|---|
238 for s in sockets: | 238 for s in sockets: |
239 for c in self.connections: | 239 for c in self.connections: |
240 if s == c._get_socket(): | 240 if s == c._get_socket(): |
241 c.lock.acquire() | 241 c.lock.acquire() |
242 if hasattr(c, 'socket'): | 242 if hasattr(c, 'socket'): |
243 c.process_data() | 243 try: |
244 c.process_data() | |
245 except ServerNotConnectedError: | |
246 if c.real_nickname == self.bot.nickname: | |
247 self.bot.restart() | |
248 else: | |
249 c.connect() | |
244 c.lock.release() | 250 c.lock.release() |
245 | 251 |
246 def process_timeout(self): | 252 def process_timeout(self): |
247 """Called when a timeout notification is due. | 253 """Called when a timeout notification is due. |
248 | 254 |