mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Let's unschedule ourselves if we are told to die.
This commit is contained in:
parent
d22449d5a0
commit
74b4628d0b
@ -63,6 +63,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
self.inbuffer = ''
|
self.inbuffer = ''
|
||||||
self.outbuffer = ''
|
self.outbuffer = ''
|
||||||
self.zombie = False
|
self.zombie = False
|
||||||
|
self.scheduled = None
|
||||||
self.connected = False
|
self.connected = False
|
||||||
self.reconnectWaitsIndex = 0
|
self.reconnectWaitsIndex = 0
|
||||||
self.reconnectWaits = reconnectWaits
|
self.reconnectWaits = reconnectWaits
|
||||||
@ -123,6 +124,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
self.reconnect(reset=False, **kwargs)
|
self.reconnect(reset=False, **kwargs)
|
||||||
|
|
||||||
def reconnect(self, wait=False, reset=True):
|
def reconnect(self, wait=False, reset=True):
|
||||||
|
self.scheduled = False
|
||||||
if self.connected:
|
if self.connected:
|
||||||
drivers.log.reconnect(self.irc.network)
|
drivers.log.reconnect(self.irc.network)
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
@ -181,10 +183,12 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
|
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
|
||||||
if not world.dying:
|
if not world.dying:
|
||||||
drivers.log.reconnect(self.irc.network, when)
|
drivers.log.reconnect(self.irc.network, when)
|
||||||
schedule.addEvent(self.reconnect, when)
|
self.scheduled = schedule.addEvent(self.reconnect, when)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
self.zombie = True
|
self.zombie = True
|
||||||
|
if self.scheduled:
|
||||||
|
schedule.removeEvent(self.scheduled)
|
||||||
drivers.log.die(self.irc)
|
drivers.log.die(self.irc)
|
||||||
|
|
||||||
def _reallyDie(self):
|
def _reallyDie(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user