Made it reset the IRC object before reconnection, and made it catch connect errors.

This commit is contained in:
Jeremy Fincher 2003-09-01 15:46:10 +00:00
parent 57b21b6394
commit 2bd4a88d76

View File

@ -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)