mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Unschedule ourselves after a reconnect and fixed a bugz0r in reconnecting.
This commit is contained in:
parent
53c951cc04
commit
faa340913d
@ -63,6 +63,7 @@ class AsyncoreDriver(asynchat.async_chat, drivers.ServersMixin):
|
|||||||
asynchat.async_chat.__init__(self)
|
asynchat.async_chat.__init__(self)
|
||||||
drivers.ServersMixin.__init__(self, irc, servers=servers)
|
drivers.ServersMixin.__init__(self, irc, servers=servers)
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
|
self.irc.driver = self # Necessary because of the way we reconnect.
|
||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
self.set_terminator('\n')
|
self.set_terminator('\n')
|
||||||
try:
|
try:
|
||||||
@ -81,8 +82,9 @@ class AsyncoreDriver(asynchat.async_chat, drivers.ServersMixin):
|
|||||||
drivers.log.reconnect(self.irc.network, when)
|
drivers.log.reconnect(self.irc.network, when)
|
||||||
def makeNewDriver():
|
def makeNewDriver():
|
||||||
self.irc.reset()
|
self.irc.reset()
|
||||||
|
self.scheduled = None
|
||||||
driver = self.__class__(self.irc, servers=self.servers)
|
driver = self.__class__(self.irc, servers=self.servers)
|
||||||
schedule.addEvent(makeNewDriver, when)
|
self.scheduled = schedule.addEvent(makeNewDriver, when)
|
||||||
|
|
||||||
def writable(self):
|
def writable(self):
|
||||||
while self.connected:
|
while self.connected:
|
||||||
@ -119,6 +121,8 @@ class AsyncoreDriver(asynchat.async_chat, drivers.ServersMixin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
|
if self.scheduled:
|
||||||
|
schedule.removeEvent(self.scheduled)
|
||||||
drivers.log.die(self.irc)
|
drivers.log.die(self.irc)
|
||||||
self.reconnect()
|
self.reconnect()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user