mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Added delayed death and fixed a bugz0r (die wasn't calling driver.IrcDriver.die)
This commit is contained in:
parent
992cbb91ee
commit
f467550400
@ -62,6 +62,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
self.eagains = 0
|
||||
self.inbuffer = ''
|
||||
self.outbuffer = ''
|
||||
self.zombie = False
|
||||
self.connected = False
|
||||
self.reconnectWaitsIndex = 0
|
||||
self.reconnectWaits = reconnectWaits
|
||||
@ -78,6 +79,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
self.eagains += 1
|
||||
|
||||
def _sendIfMsgs(self):
|
||||
if not self.zombie:
|
||||
msgs = [self.irc.takeMsg()]
|
||||
while msgs[-1] is not None:
|
||||
msgs.append(self.irc.takeMsg())
|
||||
@ -90,6 +92,8 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
self.eagains = 0
|
||||
except socket.error, e:
|
||||
self._handleSocketError(e)
|
||||
if self.zombie and not self.outbuffer:
|
||||
self._reallyDie()
|
||||
|
||||
def run(self):
|
||||
if not self.connected:
|
||||
@ -179,9 +183,13 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
schedule.addEvent(self.reconnect, when)
|
||||
|
||||
def die(self):
|
||||
self.zombie = True
|
||||
drivers.log.die(self.irc)
|
||||
|
||||
def _reallyDie(self):
|
||||
if self.conn is not None:
|
||||
self.conn.close()
|
||||
drivers.IrcDriver.die(self)
|
||||
# self.irc.die() Kill off the ircs yourself, jerk!
|
||||
|
||||
def name(self):
|
||||
|
Loading…
Reference in New Issue
Block a user