mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Another attempt to allow multiple servers in twistedDrivers.
This commit is contained in:
parent
c5325dc18c
commit
a8a5d5129e
@ -96,7 +96,8 @@ class SupyReconnectingFactory(ReconnectingClientFactory):
|
|||||||
self.irc = irc
|
self.irc = irc
|
||||||
self.networkGroup = conf.supybot.networks.get(self.irc.network)
|
self.networkGroup = conf.supybot.networks.get(self.irc.network)
|
||||||
self.servers = ()
|
self.servers = ()
|
||||||
reactor.connectTCP('', 0, self)
|
(server, port) = self._getNextServer()
|
||||||
|
reactor.connectTCP(server, port, self)
|
||||||
|
|
||||||
def _getServers(self):
|
def _getServers(self):
|
||||||
# We do this, rather than itertools.cycle the servers in __init__,
|
# We do this, rather than itertools.cycle the servers in __init__,
|
||||||
@ -113,8 +114,15 @@ class SupyReconnectingFactory(ReconnectingClientFactory):
|
|||||||
self.currentServer = '%s:%s' % server
|
self.currentServer = '%s:%s' % server
|
||||||
return server
|
return server
|
||||||
|
|
||||||
|
def clientConnectionFailed(self, connector, r):
|
||||||
|
(connector.host, connector.port) = self._getNextServer()
|
||||||
|
ReconnectingClientFactory.clientConnectionFailed(self, connector, r)
|
||||||
|
|
||||||
|
def clientConnectionLost(self, connector, r):
|
||||||
|
(connector.host, connector.port) = self._getNextServer()
|
||||||
|
ReconnectingClientFactory.clientConnectionLost(self, connector, r)
|
||||||
|
|
||||||
def buildProtocol(self, addr):
|
def buildProtocol(self, addr):
|
||||||
addr = self._getNextServer()
|
|
||||||
protocol = ReconnectingClientFactory.buildProtocol(self, addr)
|
protocol = ReconnectingClientFactory.buildProtocol(self, addr)
|
||||||
protocol.irc = self.irc
|
protocol.irc = self.irc
|
||||||
return protocol
|
return protocol
|
||||||
|
Loading…
Reference in New Issue
Block a user