Same fix for asyncoreDrivers and a small cleanup.

This commit is contained in:
Stéphan Kochen 2004-04-12 21:44:03 +00:00
parent ff3c996deb
commit 03294c8686
2 changed files with 6 additions and 5 deletions

View File

@ -72,10 +72,11 @@ class AsyncoreDriver(asynchat.async_chat, object):
log.warning('Error connecting to %s: %s', self.server[0], e)
self.reconnect(wait=True)
def scheduleReconnect(self):
when = log.timestamp(time.time()+60)
def _scheduleReconnect(self):
when = time.time() + 60
if not world.dying:
log.info('Scheduling reconnect to %s at %s', self.server[0], when)
whenS = log.timestamp(when)
log.info('Scheduling reconnect to %s at %s', self.server[0], whenS)
def makeNewDriver():
self.irc.reset()
driver = self.__class__(self.server, self.irc)
@ -104,7 +105,7 @@ class AsyncoreDriver(asynchat.async_chat, object):
self.irc.feedMsg(msg)
def handle_close(self):
self.scheduleReconnect()
self._scheduleReconnect()
self.die()
reconnect = handle_close

View File

@ -175,8 +175,8 @@ class SocketDriver(drivers.IrcDriver):
def _scheduleReconnect(self):
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
whenS = log.timestamp(when)
if not world.dying:
whenS = log.timestamp(when)
log.info('Scheduling reconnect to %s at %s', self.server, whenS)
schedule.addEvent(self.reconnect, when)