예제 #1
0
    def clientConnectionLost(self, connector, reason):
        log.msg('MonitorClient connection lost, reason {}'.format(reason))

        if self.disconnected_cb:
            self.disconnected_cb()

        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #2
0
	def clientConnectionLost(self, connector, reason):
		global ncidsrv
		if not self.hangup_ok and config.plugins.NcidClient.connectionVerbose.value:
			Notifications.AddNotification(MessageBox, _("Connection to NCID Server lost\n (%s)\nretrying...") % reason.getErrorMessage(), type=MessageBox.TYPE_INFO, timeout=config.plugins.NcidClient.timeout.value)
		ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
		# config.plugins.NcidClient.enable.value = False
		ncidsrv = None
예제 #3
0
 def clientConnectionLost(self, connector, reason):
     """
     Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method
     """
     if self.debug:
         print('IPAFactory connection lost:', reason.getErrorMessage())
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #4
0
파일: client.py 프로젝트: p0is0n/txsphinx
	def clientConnectionLost(self, connector, reason):
		"""
		Notify the pool that we've lost our connection.
		"""
		if self.protocolInstance is not None:
			if self.protocolInstance._lastreq and ((time() - self.protocolInstance._lastreq) >= 100):
				self.stopTrying()

		if self.continueTrying:
			ReconnectingClientFactory.clientConnectionLost(self, connector, reason)

			# pool pendings
			self.pool.addPendings(self)
		else:
			if DEBUG:
				log.msg('Sphinx factory stop', self)

			if self.deferred:
				self.deferred.errback(reason)

				# Clean deferred
				self.deferred = None
			else:
				# pool pendings
				self.pool.delPendings(self)

		if self.protocolInstance is not None:
			self.pool.clientGone(self.protocolInstance)

		# Clean
		self.protocolInstance = None
예제 #5
0
파일: factory.py 프로젝트: fbs/fubot
 def clientConnectionLost(self, connector, unused_reason):
     """Handle a lost connection"""
     if self.bot.quitting:
         log.msg('Factory shutting down, quitting')
         return
     RCF.clientConnectionLost(self, connector, unused_reason)
     log.msg('Factory reconnecting')
예제 #6
0
    def clientConnectionLost(self, connector, reason):
        """ We are called when our connection is lost. Start trying to create a new connection. """

        self.logger.warn('CmdrConnection lost: %s ' % reason)
        
        self.activeConnection = None
        self.stateCallback(self)
        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #7
0
    def clienConnectionLost(self, connector, reason):
        """ **********************************************************
        Called when a connection has been lost after it was connected

        @type reason: L{twisted.python.fialure.Failure}
        ******************************************************* """
        print 'Lost Connection. Reason:', reason
        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #8
0
 def clientConnectionLost(self, connector, reason):
     print 'Lost connection.  Reason:', reason
     print "Wanttobelogged in %s %s" % \
         (self, self.session.want_to_be_logged_in)
     if not self.session.want_to_be_logged_in:
         self.stopTrying()
     else:
         RCF.clientConnectionLost(self, connector, reason)
예제 #9
0
 def clientConnectionLost(self, connector, reason):
     log.msg("Lost connection. Reason: %s" % reason, logLevel=INFO)
     if getattr(self, "restart", True):
         self.reset_protocol_for_login()
         ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     else:
         log.msg("Done - no restart", logLevel=INFO)
         reactor.callWhenRunning(reactor.stop)
예제 #10
0
파일: client.py 프로젝트: Cue/graphite
 def clientConnectionLost(self, connector, reason):
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     log.clients(
         "%s::clientConnectionLost (%s:%d) %s" % (self, connector.host, connector.port, reason.getErrorMessage())
     )
     self.connectedProtocol = None
     self.connectionLost.callback(0)
     self.connectionLost = Deferred()
예제 #11
0
	def clientConnectionLost(self, connector, reason):
		print "* Disconnected from server."
		if self.quitted:
			print "* Exiting main loop."
			reactor.stop()
		else:
			print "* Reconnecting..."
			ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #12
0
    def clientConnectionLost(self, connector, reason):
        # Delete current connection
        self.active_protocol = None

        # Retry connection to the server
        log.err('Lost connection.  Reason: {0}'.format(reason.getErrorMessage()))
        if self.running_state == True:
            ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #13
0
    def clientConnectionLost(self, connector, reason):
        """
        self.CONNECTION_INFO ok
        """
        self.continueTrying = None

        log.msg('Lost connection. Reason: ', reason)
        ReconnectingClientFactory.clientConnectionLost(self,\
         connector, reason)
예제 #14
0
 def clientConnectionLost(self, connector, reason):
     if not shuttingdown:
         logging.debug('Lost connection to Envisalink.  Reason: %s', str(reason))
         if hasattr(self, "_currentLoopingCall"):
             try:
                 self._currentLoopingCall.stop()
             except:
                 logging.error("Error trying to stop looping call, ignoring...")
         ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #15
0
 def clientConnectionLost(self, connector, reason):
     Logger.info(self.__class__.__name__ + ': Lost connection. ' + str(reason.value))
     if 'Connection was closed cleanly' in str(reason.value):
         Logger.debug(self.__class__.__name__ + ': Clean disconnect.')
         self.stopTrying()
     else:
         Logger.info(self.__class__.__name__ + ': Tracker not connected?')
          
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     self.eyeTracker.connectedFlag = False
예제 #16
0
    def clientConnectionLost(self, connector, reason):
        """
        Called when the connection to the server is lost.
        Re-initialise per-connection variables and looping calls.
        """
        ReconnectingClientFactory.clientConnectionLost(
            self, connector, reason)
        self.ackmap.stopChecker()

        self.init()
예제 #17
0
    def test_parametrizedClock(self):
        """
        The clock used by L{ReconnectingClientFactory} can be parametrized, so
        that one can cleanly test reconnections.
        """
        clock = Clock()
        factory = ReconnectingClientFactory()
        factory.clock = clock

        factory.clientConnectionLost(FakeConnector(), None)
        self.assertEqual(len(clock.calls), 1)
예제 #18
0
파일: kato.py 프로젝트: EzanLTD/katirc
    def clientConnectionLost(self, connector, reason):
        self.kato_client = None

        try:
            reason.trap(ConnectionDone)
            # clean connection close; do nothing
            print 'Connection closed. Reason:', reason
        except:
            # not a clean connection close; reconnect
            print 'Lost connection. Reason:', reason
            ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #19
0
    def clientConnectionLost(self, connector, reason):
        self._p.alive = False

        logger.info('Lost connection. Reason: {}'.format(reason))

        self.attempt += 1
        logger.info('Relogin attempt {}'.format(self.attempt))

        self.relogin()

        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #20
0
파일: client.py 프로젝트: drawks/carbon
  def clientConnectionLost(self, connector, reason):
    ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
    log.clients("%s::clientConnectionLost (%s:%d) %s" % (
        self, connector.host, connector.port, reason.getErrorMessage()))
    self.connectedProtocol = None

    self.destinationDown(connector.factory.destination)

    args = dict(connector=connector, reason=reason)
    d = self.connectionLost
    self.connectionLost = Deferred()
    d.callback(args)
예제 #21
0
파일: client.py 프로젝트: shrick/ncidmon
 def clientConnectionLost(self, connector, reason):
     self._failures = 0
     dprint('lost connection:', reason.getErrorMessage())
     
     if self._listen:
         ReconnectingClientFactory.clientConnectionLost(
             self, connector, reason)
     else:
         try:
             self.reactor.stop()
         except:
             # ignore if no more running
             pass
예제 #22
0
 def clientConnectionLost(self, connector, reason):
     d, self.on_disconnected = self.on_disconnected, None
     if self.continueTrying == 0:
         LOG.debug("Connection with server was closed.")
         # Invoke callback and tell that connection was closed cleanly
         if d:
             d.callback(None)
     else:
         LOG.error("Connection with server is lost: {0}".format(
                   unicode(reason.value)))
         self._update_deferreds()
         # Invoke callback and tell that connection was lost
         if d:
             d.errback(reason)
         ReconnectingClientFactory.clientConnectionLost(
             self, connector, reason)
예제 #23
0
파일: pool.py 프로젝트: rlotun/txconnpool
    def clientConnectionLost(self, connector, reason):
        """
        Notify the connectionPool that we've lost our connection.
        """

        if self.connectionPool.shutdown_requested:
            # The reactor is stopping; don't reconnect
            return

        if self._protocolInstance is not None:
            self.connectionPool.clientBusy(self._protocolInstance)

        ReconnectingClientFactory.clientConnectionLost(
            self,
            connector,
            reason)
예제 #24
0
    def clientConnectionLost(self, connector, reason):
        # Disable modules
        if connector.host in self.bot.moduleHandler.enabledModules:
            for module in self.bot.moduleHandler.enabledModules[connector.host]:
                self.bot.moduleHandler.disableModule(module, connector.host, True)

        self.bot.moduleHandler.runGenericAction("disconnect", connector.host)
        del self.bot.servers[connector.host]

        # Check whether or not we should reconnect
        if connector.host in self.currentlyDisconnecting:
            self.bot.log.info("Connection to {connector.host} was closed cleanly.", connector=connector)
            ClientFactory.clientConnectionLost(self, connector, reason)
            self.currentlyDisconnecting.remove(connector.host)
            self.bot.countConnections()
        else:
            ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #25
0
    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)
예제 #26
0
    def clientConnectionLost(self, connector, reason):
        """
        Notify the pool that we've lost our connection.
        """
        self.errors += 1

        # Stop
        if self.errors >= self.errorsLimit:
            self.stopTrying()

        if self.continueTrying:
            if self.protocolInstance is not None:
                if self.protocolInstance._lastreq and ((time() - self.protocolInstance._lastreq) >= 100):
                    self.stopTrying()

        if self.continueTrying:
            ReconnectingClientFactory.clientConnectionLost(self, connector, reason)

            # pool pendings
            self.pool.addPendings(self)
        else:
            if self.deferred:
                if self.protocolError is not None:
                    self.deferred.errback(self.protocolError)
                else:
                    self.deferred.errback(reason)

                # Clean deferred
                self.deferred = None
            else:
                # pool pendings
                self.pool.delPendings(self)

        if self.protocolInstance is not None:
            self.pool.clientGone(self.protocolInstance)

        # Clean
        self.protocolInstance = None
        self.protocolError = None
예제 #27
0
    def clientConnectionLost(self, connector, reason):
        """ Override client connection lost method
        Called when and established connection is lost
        @param connector:
        @param reason:
        @return:
        """
        CONNECTION_INFO = misc.get_data_local_file(settingsFile='.settings')
        print CONNECTION_INFO['reconnection']


        """
        if self.CONNECTION_INFO['reconnection'] == 'yes':
            self.continueTrying = True
        elif self.CONNECTION_INFO['reconnection'] == 'no':
            self.continueTrying = None
        """

        log.msg('Lost connection. Reason: ', reason)
        ReconnectingClientFactory.clientConnectionLost(self,
                                                       connector,
                                                       reason)
예제 #28
0
    def clientConnectionLost(self, connector, reason):
        """Handle notification from the lower layers of connection loss.

        If we are shutting down, and twisted sends us the expected type of
        error, eat the error. Otherwise, log it and pass it along.
        Also, schedule notification of our subscribers at the next pass
        through the reactor.
        """
        if self.dDown and reason.check(ConnectionDone):
            # We initiated the close, this is an expected close/lost
            log.debug('%r: Connection Closed:%r:%r', self, connector, reason)
            notifyReason = None  # Not a failure
        else:
            log.debug('%r: clientConnectionLost:%r:%r', self, connector,
                      reason)
            notifyReason = reason

        # Reset our proto so we don't try to send to a down connection
        self.proto = None
        # Schedule notification of subscribers
        self._get_clock().callLater(0, self._notify, False, notifyReason)
        # Call our superclass's method to handle reconnecting
        ReconnectingClientFactory.clientConnectionLost(
            self, connector, reason)
예제 #29
0
 def clientConnectionFailed(self, connector, reason):
     print 'Connection failed:', reason.getErrorMessage()
     # Try to reconnect
     print 'Trying to reconnect. Please wait...'
     ReconnectingClientFactory.clientConnectionLost(
         self, connector, reason)
예제 #30
0
 def clientConnectionLost(self, connector, reason):
     log.msg('Lost connection (%s). Reason: %s' % (self.variation, reason),
                                                       logLevel=logging.INFO)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     self.yelp()
예제 #31
0
 def clientConnectionLost(self, connector, reason):
     irc_log.error('lost monitor IRC connection: %s', reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #32
0
파일: hermes.py 프로젝트: thilp/udp2irc
 def clientConnectionLost(self, connector, reason):
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     log.err('IRC connection lost: %s' % reason)
     self.retry(connector)
예제 #33
0
 def clientConnectionLost(self, connector, reason):
     log("Lost Connection, reason: %s" % reason.getErrorMessage(), syslog.LOG_WARNING)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #34
0
 def clientConnectionLost(self, connector, reason):
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #35
0
 def clientConnectionLost(self, connector, reason):
     logging.info('Lost connection.  Reason: %s', reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     dashboard_server.broadcast('q' + 'Connection to DMRlink Lost')
 def clientConnectionLost(self, connector, reason):
     logging.debug(
         'E4BLEClient - E4Client %s Lost connection.  Reason: %s' %
         (self.client_id, reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #37
0
 def clientConnectionLost(self, connector, unused_reason):
     self._controller_instance = None
     ReconnectingClientFactory.clientConnectionLost(self, connector, unused_reason)
예제 #38
0
 def clientConnectionLost(self, connector, reason):
     if not self.hangup_ok:
         print("Connection to NCID Server lost\n (%s)\nretrying..." % reason.getErrorMessage())
         ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #39
0
 def clientConnectionLost(self, connector, reason):
   ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
   log.clients("%s::clientConnectionLost (%s:%d) %s" % (self, connector.host, connector.port, reason.getErrorMessage()))
   self.connectedProtocol = None
   self.connectionLost.callback(0)
   self.connectionLost = Deferred()
예제 #40
0
파일: client.py 프로젝트: syamgk/synapse
 def clientConnectionLost(self, connector, reason):
     logger.error("Lost replication conn: %r", reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #41
0
 def clientConnectionLost(self, connector, reason):
     if self.application.disconnecting:
         return
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
 def clientConnectionLost(self, connector, reason):
     print("Connection lost - try to reconnect! " + str(reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
 def clientConnectionLost(self, connector, reason):
     logging.error('Proxy - Lost connection.  Reason: %s' % (reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
    def clientConnectionLost(self, connector, reason):
        self._p.alive = False

        logger.info('Lost connection. Reason: {}'.format(reason))
        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #45
0
파일: fnemon.py 프로젝트: gatekeep/dvmfne
 def clientConnectionLost(self, connector, reason):
     global WEBSOCK_OPCODES
     logging.info('Lost connection.  Reason: %s', reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     dashboard_server.broadcast(WEBSOCK_OPCODES['QUIT'] +
                                'Connection to FNE Lost')
예제 #46
0
 def clientConnectionLost(self, connector, reason):
     LOGERROR(
         '***Connection to Satoshi client LOST!  Attempting to reconnect...'
     )
     self.func_loseConnect()
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #47
0
 def clientConnectionLost(self, connector, reason):
     print('Lost connection.  Reason:', reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #48
0
 def clientConnectionFailed(self, connector, reason):
     log.msg('Connection failed (%s). Reason: %s' % (self.variation, reason),
                                                       logLevel=logging.INFO)
     self.running = False
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     self.yelp()
예제 #49
0
 def clientConnectionLost(self, connector: Connector,
                          reason: Failure) -> None:
     logger.debug('Lost connection.  Reason: {!r}'.format(reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #50
0
 def clientConnectionLost(self, connector, reason):
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
     self.disconnected_callback()
예제 #51
0
 def clientConnectionLost(self, connector, reason):
     out.info("Connection lost with reason: " + str(reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #52
0
파일: client.py 프로젝트: kmcintyre/scewpt
 def clientConnectionLost(self, connector, reason):
     print 'clientConnectionLost:', connector.getDestination().host, 'reason:', reason
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #53
0
 def clientConnectionLost(self, connector, reason):
     log.msg('Connection lost: %s' % (reason.value,))
     self.window.clear()
     self.window.addstr(0, 0, 'Connection lost: %s' % (reason.value,))
     self.window.refresh()
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #54
0
    def clientConnectionLost(self, connector, reason):
        """ Called when the network connection to the APN feedback
            service has been lost. """

        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #55
0
    def clientConnectionFailed(self, connector, reason):
        """ The connection attempt to the APN feedback service has failed. """

        log.err("Unable to connect to the APN feedback service")

        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #56
0
 def clientConnectionLost(self, connector, reason):
     if self.is_reconnecting:
         log.debug(reason)
         ReconnectingClientFactory.clientConnectionLost(
             self, connector, reason)
예제 #57
0
 def clientConnectionLost(self, connector, reason):
     print('[Websocket]  Lost connection. Reason: {}'.format(reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
 def clientConnectionFailed(self, connector, reason):
     print("Connection failed - try to reconnect " + str(reason))
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #59
0
   	def clientConnectionLost(self, connector, reason):
		print "Lost connection. Reason:", reason
		ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
예제 #60
0
 def clientConnectionFailed(self, connector, reason):
     log.msg('APNSClientFactory clientConnectionFailed reason=%s' % reason)
     ReconnectingClientFactory.clientConnectionLost(self, connector, reason)