def buildProtocol(self, addr): p = ReconnectingClientFactory.buildProtocol(self, addr) print 'p:', p reactor.callLater(0, self.creator.callback, p) self.retries = 0 self.delay = self.initialDelay self.factor = 1.6180339887498948 return p
def buildProtocol(self, address): """ Calls the setup method of the protocal, passing in an instance of the factory """ p = ReconnectingClientFactory.buildProtocol(self, address) p.setup(self) return p
def buildProtocol(self, addr): try: #will create a protocol of the class given in self.protocol (set in the ctor) p = ReconnectingClientFactory.buildProtocol(self, addr) except Exception, e: #this could happen if, for instance, we can't start a helper prog (such as vboxwebsrv) reactor.stop() raise
def buildProtocol(self, addr): """ Create a single protocol for communicating with game server's console. """ client = ReconnectingClientFactory.buildProtocol(self, addr) client.parser = self.parser or ConsolePassthroughParser() client.timeout_value = self.timeout_value or REQUEST_TIMEOUT self.client = client return self.client
def buildProtocol(self, addr): """Create a KafkaProtocol object, store it in self.proto, return it.""" # Schedule notification of subscribers self._get_clock().callLater(0, self._notify, True) # Build the protocol self.proto = ReconnectingClientFactory.buildProtocol(self, addr) # point it at us for notifications of arrival of messages self.proto.factory = self return self.proto
def buildProtocol(self, addr): protocol = ReconnectingClientFactory.buildProtocol(self, addr) protocol.settings = self.settings # Set various properties defined by Twisted's IRCClient. protocol.nickname = self.settings.nickname or protocol.nickname protocol.password = self.settings.password or protocol.password protocol.realname = self.settings.realname or protocol.realname protocol.username = self.settings.username or protocol.username protocol.userinfo = self.settings.userinfo or protocol.userinfo self.protocols.add(protocol) return protocol
def test_stopTryingWhenConnected(self): """ If a L{ReconnectingClientFactory} has C{stopTrying} called while it is connected, it does not subsequently attempt to reconnect if the connection is later lost. """ class NoConnectConnector(object): def stopConnecting(self): raise RuntimeError("Shouldn't be called, we're connected.") def connect(self): raise RuntimeError("Shouldn't be reconnecting.") c = ReconnectingClientFactory() c.protocol = Protocol # Let's pretend we've connected: c.buildProtocol(None) # Now we stop trying, then disconnect: c.stopTrying() c.clientConnectionLost(NoConnectConnector(), None) self.assertFalse(c.continueTrying)
def buildProtocol(self, addr): # Build the protocol. p = ReconnectingClientFactory.buildProtocol(self, addr) # If we do not care about connecting to a slave, then we can simply # return the protocol now and fire that we are ready. if self.uri['options'].get('slaveok', False): self.setInstance(instance=p) return p # Update our server configuration. This may disconnect if the node # is not a master. p.connectionReady().addCallback(lambda _: self.configure(p)) return p
def buildProtocol(self, address): proto = ReconnectingClientFactory.buildProtocol(self, address) proto.label = self.label proto.nickname = self.nickname proto.password = self.password proto.channels = self.channels proto.admins = self.admins proto.network = address proto.host = self.host proto.relay_active = True proto.debug = True proto.state = self.state proto.identifier = '%s@%s' % (','.join(proto.channels), proto.host) return proto
def buildProtocol(self, address): proto = ReconnectingClientFactory.buildProtocol(self, address) proto.container = self.container # for shortcut access: proto.settings = self.container._settings if proto.settings.enablestate: proto.state = self.container.state else: proto.state = None proto.dispatch = proto.settings.dispatcher.dispatch proto.dispatcher = proto.settings.dispatcher proto.nickname = proto.settings.nick #throttle queue proto._dqueue = deque() #debug proto.debug = proto.settings.debug return proto
def buildProtocol(self, addr): # Build the protocol. p = ReconnectingClientFactory.buildProtocol(self, addr) ready_deferred = p.connectionReady() if not self.uri['options'].get('slaveok', False): # Update our server configuration. This may disconnect if the node # is not a master. ready_deferred.addCallback(lambda _: self.configure(p)) ready_deferred\ .addCallback(lambda _: self._auth_proto(p))\ .addBoth(lambda _: self.setInstance(instance=p)) return p
def buildProtocol(self, addr): # Build the protocol. p = ReconnectingClientFactory.buildProtocol(self, addr) log.err('connected to mongo %s' % addr) # on connection ensure we reset potential delays from previous # reconnect attempts self.resetDelay() # If we do not care about connecting to a slave, then we can simply # return the protocol now and fire that we are ready. if self.__slave_ok: p.connectionReady().addCallback(lambda _: self.setInstance(instance=p)) # if we had reconnected, authenticate the db objects again if self.__reconnected: p.connectionReady().addCallback(lambda _: self.onReconnect()) return p # Update our server configuration. This may disconnect if the node # is not a master. p.connectionReady().addCallback(lambda _: self.configure(p)) return p
def buildProtocol(self, addr): self.resetDelay() return ReconnectingClientFactory.buildProtocol(self, addr)
def buildProtocol(self, addr): # Build the protocol. p = ReconnectingClientFactory.buildProtocol(self, addr) self._initializeProto(p) return p
def buildProtocol(self, addr): self.resetDelay() #if not self.is_reconnecting: raise return ReconnectingClientFactory.buildProtocol(self, addr)
def buildProtocol(self, addr): self.resetDelay() self.addr = addr self.divvyProtocol = ReconnectingClientFactory.buildProtocol(self, addr) self.divvyProtocol.debug_mode = self.debug_mode return self.divvyProtocol
def buildProtocol(self, addr): print 'build protocol' return ReconnectingClientFactory.buildProtocol(self, addr)
def buildProtocol(self, addr): # Build the protocol. p = ReconnectingClientFactory.buildProtocol(self, addr) self._initializeProto(p) return p
def buildProtocol(self, p_addr): LOG.info('BuildProtocol - Addr = {}'.format(p_addr)) _l_client = SamsungClient(self.m_pyhouse_obj, self.m_samsung_obj) l_ret = ReconnectingClientFactory.buildProtocol(self, p_addr) return l_ret
def buildProtocol(self, address): '''Creates and instance of the client protocol and resets the connection delay.''' self.resetDelay() return ReconnectingClientFactory.buildProtocol(self, address)
def buildProtocol(self, *args): print 'I: Connected.' self.resetDelay() return ReconnectingClientFactory.buildProtocol(self, *args)
def buildProtocol(self, addr): protocol = ReconnectingClientFactory.buildProtocol(self, addr) protocol.irc = self.irc return protocol
def buildProtocol(self, addr): p = ReconnectingClientFactory.buildProtocol(self, addr) p.callback = self.callback self.resetDelay() return p
def buildProtocol(self, addr): # Reset the ReconnectingClientFactory reconnect delay because we don't # want the next disconnect to force karmabot to delay forever. self.resetDelay() return ReconnectingClientFactory.buildProtocol(self, addr)
def buildProtocol(self, addr): protocol = ReconnectingClientFactory.buildProtocol(self, addr) protocol.irc = self.irc return protocol
def buildProtocol(self, addr): # Reset the ReconnectingClientFactory reconnect delay because we don't # want the next disconnect to force karmabot to delay forever. self.resetDelay() return ReconnectingClientFactory.buildProtocol(self, addr)
def buildProtocol(self, addr): self.resetDelay() #if not self.is_reconnecting: raise return ReconnectingClientFactory.buildProtocol(self, addr)