mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Made it reset the IRC object before reconnection, and made it catch connect errors.
This commit is contained in:
parent
57b21b6394
commit
2bd4a88d76
@ -96,11 +96,16 @@ class SocketDriver(drivers.IrcDriver):
|
|||||||
#debug.methodNamePrintf(self, 'reconnect')
|
#debug.methodNamePrintf(self, 'reconnect')
|
||||||
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.conn.settimeout(conf.poll)
|
self.conn.settimeout(conf.poll)
|
||||||
self.conn.connect(self.server)
|
try:
|
||||||
|
self.conn.connect(self.server)
|
||||||
|
except socket.error, e:
|
||||||
|
debug.msg('Error connecting to %s: %s' % (self.server, e))
|
||||||
|
self.die()
|
||||||
self.connected = True
|
self.connected = True
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
#debug.methodNamePrintf(self, 'die')
|
#debug.methodNamePrintf(self, 'die')
|
||||||
|
self.irc.reset()
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
self.connected = False
|
self.connected = False
|
||||||
schedule.addEvent(self.reconnect, time.time()+300)
|
schedule.addEvent(self.reconnect, time.time()+300)
|
||||||
|
Loading…
Reference in New Issue
Block a user