def connectionLost(self, reason):
"""
Invoked by lower-level logic when it's time to clean the socket up.
Depending on the state of the connection, either inform the attached
L{Connector} that the connection attempt has failed, or inform the
connected L{IProtocol} that the established connection has been lost.
@param reason: the reason that the connection was terminated
@type reason: L{Failure}
"""
if not self.connected:
self.failIfNotConnected(error.ConnectError(string=reason))
else:
self._commonConnection.connectionLost(self, reason)
self.connector.connectionLost(reason)
评论列表
文章目录