mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 20:14:20 +01:00
Finally fixed looping bug
This commit is contained in:
parent
7c31468866
commit
a5fc83ef63
@ -67,7 +67,21 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
|||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
self.set_terminator('\n')
|
self.set_terminator('\n')
|
||||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
try:
|
||||||
self.connect(self.server)
|
self.connect(self.server)
|
||||||
|
except:
|
||||||
|
debug.recoverableException()
|
||||||
|
self.scheduleReconnect()
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def scheduleReconnect(self):
|
||||||
|
if self.reconnect:
|
||||||
|
def makeNewDriver():
|
||||||
|
self.irc.reset()
|
||||||
|
driver = self.__class__(self.server, reconnect=self.reconnect)
|
||||||
|
driver.irc = self.irc
|
||||||
|
driver.irc.driver = driver
|
||||||
|
schedule.addEvent(makeNewDriver, time.time() + 60)
|
||||||
|
|
||||||
def writable(self):
|
def writable(self):
|
||||||
#debug.methodNamePrintf(self, 'writable')
|
#debug.methodNamePrintf(self, 'writable')
|
||||||
@ -83,6 +97,8 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
|||||||
|
|
||||||
def handle_error(self):
|
def handle_error(self):
|
||||||
debug.recoverableException()
|
debug.recoverableException()
|
||||||
|
self.scheduleReconnect()
|
||||||
|
self.close()
|
||||||
|
|
||||||
def collect_incoming_data(self, s):
|
def collect_incoming_data(self, s):
|
||||||
#debug.methodNamePrintf(self, 'collect_incoming_data')
|
#debug.methodNamePrintf(self, 'collect_incoming_data')
|
||||||
@ -109,19 +125,7 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
|||||||
|
|
||||||
def handle_close(self):
|
def handle_close(self):
|
||||||
#debug.methodNamePrintf(self, 'handle_close')
|
#debug.methodNamePrintf(self, 'handle_close')
|
||||||
if self.reconnect:
|
self.scheduleReconnect()
|
||||||
#debug.printf('Yes, reconnect.')
|
|
||||||
def makeNewDriver():
|
|
||||||
#debug.printf('Called makeNewDriver')
|
|
||||||
self.irc.reset()
|
|
||||||
driver = self.__class__(self.server, reconnect=self.reconnect)
|
|
||||||
driver.irc = self.irc
|
|
||||||
driver.irc.driver = driver
|
|
||||||
schedule.addEvent(makeNewDriver, time.time() + 60)
|
|
||||||
self.die()
|
|
||||||
|
|
||||||
def die(self):
|
|
||||||
#debug.methodNamePrintf(self, 'die')
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user