Make sure we don't try to access self.currentServer before it's there. Also,

return the new server from _getNextServer
This commit is contained in:
James Vega 2005-01-11 13:52:56 +00:00
parent f39a2849d3
commit e54ef5d6df

View File

@ -55,7 +55,8 @@ reconnectWaits = [0, 60, 300]
class SocketDriver(drivers.IrcDriver, drivers.ServersMixin): class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
def __init__(self, irc): def __init__(self, irc):
self.irc = irc self.irc = irc
super(SocketDriver, self).__init__(irc) self.__parent = super(SocketDriver, self)
self.__parent.__init__(irc)
self.conn = None self.conn = None
self.servers = () self.servers = ()
self.eagains = 0 self.eagains = 0
@ -69,11 +70,12 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
self.connect() self.connect()
def _getNextServer(self): def _getNextServer(self):
oldServer = self.currentServer oldServer = getattr(self, 'currentServer', None)
super(SocketDriver, self)._getNextServer() server = self.__parent._getNextServer()
if self.currentServer != oldServer: if self.currentServer != oldServer:
self.reconnectWaitsIndex = 0 self.reconnectWaitsIndex = 0
return server
def _handleSocketError(self, e): def _handleSocketError(self, e):
# (11, 'Resource temporarily unavailable') raised if connect # (11, 'Resource temporarily unavailable') raised if connect
# hasn't finished yet. We'll keep track of how many we get. # hasn't finished yet. We'll keep track of how many we get.