mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 20:22:45 +01:00
Socket: de-register setTimeout from supybot.drivers.poll's callbacks when dying.
This commit is contained in:
parent
88549f9faa
commit
fabe8a284e
@ -307,10 +307,8 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
'<http://docs.limnoria.net/en/latest/use/faq.html#how-to-make-a-connection-secure>')
|
||||
% self.irc.network)
|
||||
|
||||
def setTimeout():
|
||||
self.conn.settimeout(conf.supybot.drivers.poll())
|
||||
conf.supybot.drivers.poll.addCallback(setTimeout)
|
||||
setTimeout()
|
||||
conf.supybot.drivers.poll.addCallback(self.setTimeout)
|
||||
self.setTimeout()
|
||||
self.connected = True
|
||||
self.resetDelay()
|
||||
except socket.error as e:
|
||||
@ -327,6 +325,9 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
return
|
||||
self._instances.append(self)
|
||||
|
||||
def setTimeout():
|
||||
self.conn.settimeout(conf.supybot.drivers.poll())
|
||||
|
||||
def _checkAndWriteOrReconnect(self):
|
||||
self.writeCheckTime = None
|
||||
drivers.log.debug('Checking whether we are connected.')
|
||||
@ -353,6 +354,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
def die(self):
|
||||
if self in self._instances:
|
||||
self._instances.remove(self)
|
||||
conf.supybot.drivers.poll.removeCallback(self.setTimeout)
|
||||
self.zombie = True
|
||||
if self.nextReconnectTime is not None:
|
||||
self.nextReconnectTime = None
|
||||
|
Loading…
Reference in New Issue
Block a user