本文整理汇总了Python中twisted.internet.protocol.ReconnectingClientFactory.clientConnectionLost方法的典型用法代码示例。如果您正苦于以下问题:Python ReconnectingClientFactory.clientConnectionLost方法的具体用法?Python ReconnectingClientFactory.clientConnectionLost怎么用?Python ReconnectingClientFactory.clientConnectionLost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.protocol.ReconnectingClientFactory
的用法示例。
在下文中一共展示了ReconnectingClientFactory.clientConnectionLost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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
示例2: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例3: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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
示例4: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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')
示例5: clienConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例6: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例7: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例8: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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()
示例9: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例10: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例11: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例12: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)
示例13: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
def clientConnectionLost(self, connector, reason):
"""
self.CONNECTION_INFO ok
"""
self.continueTrying = None
log.msg('Lost connection. Reason: ', reason)
ReconnectingClientFactory.clientConnectionLost(self,\
connector, reason)
示例14: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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
示例15: clientConnectionLost
# 需要导入模块: from twisted.internet.protocol import ReconnectingClientFactory [as 别名]
# 或者: from twisted.internet.protocol.ReconnectingClientFactory import clientConnectionLost [as 别名]
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)