本文整理汇总了Python中twisted.internet.protocol.connectionDone方法的典型用法代码示例。如果您正苦于以下问题:Python protocol.connectionDone方法的具体用法?Python protocol.connectionDone怎么用?Python protocol.connectionDone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.protocol
的用法示例。
在下文中一共展示了protocol.connectionDone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""Handle a disconnect from a client.
"""
super().connectionLost(reason)
session = self._session
if session is not None:
_LOGGER.info('Terminating session %08x', session['id'])
_utils.wg_dev_delete(session['interface'])
session_name = _session_fname(session)
session_network = self._networks[session['network']]
session_network['pool'].free(
owner=session_name,
owned_ip=session['client_ip']
)
fs.rm_safe(
os.path.join(self._sessions_dir, session_name)
)
self._session = None
示例2: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""Override Protocol.connectionLost."""
LOG.w("Connection lost:", self.handle)
try:
self.ping_timeout.cancel()
except Exception:
pass
try:
self.ping_timer.cancel()
except Exception:
pass
if self.handle in exchange.known_clients:
exchange.client_disconnected(self.handle)
示例3: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
self.factory._connectionLost(reason)
self.factory = None
示例4: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
self.disconnected = reason
self._log.debug("Server connection lost: {reason}", reason=reason)
示例5: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""
We are no longer connected
"""
self.setTimeout(None)
self.mailFile = None
示例6: loseConnection
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def loseConnection(self):
self.proto.connectionLost(protocol.connectionDone)
示例7: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
self.factory.unregister(self)
示例8: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
"""
:param reason: reason for disconnection.
"""
self.observer.onDisconnection(reason)
示例9: connection_lost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connection_lost(self, exception=connectionDone):
"""
:param exception: reason for disconnection.
"""
self.observer.onDisconnection(exception)
示例10: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
abstract.FileDescriptor.connectionLost(self, reason)
if self.fd is not None:
os.close(self.fd)
self.fd = None
return self.protocol.connectionLost(reason)
示例11: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=connectionDone):
logger.debug('%s disconnected. remainder connected: %d', self.peer, self.factory.num_connections)
self.factory.remove_connection(self)
if self.peer_manager:
self.peer_manager.remove_channel(self)
示例12: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""We are no longer connected"""
self.setTimeout(None)
self.mailFile = None
示例13: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
wlog("INFO", "Lost IRC connection to: " + str(self.hostname)
+ " . Should reconnect automatically soon.")
if self.wrapper.on_disconnect:
reactor.callLater(0.0, self.wrapper.on_disconnect, self.wrapper)
return irc.IRCClient.connectionLost(self, reason)
示例14: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""Callback invoked on connection lost."""
_LOGGER.info('connection lost')
示例15: connectionLost
# 需要导入模块: from twisted.internet import protocol [as 别名]
# 或者: from twisted.internet.protocol import connectionDone [as 别名]
def connectionLost(self, reason=protocol.connectionDone):
"""Callback invoked on connection lost."""
_LOGGER.info('connection lost')
self._ctx = None