当前位置: 首页>>代码示例>>Python>>正文


Python WampWebSocketClientProtocol.connectionLost方法代码示例

本文整理汇总了Python中autobahn.twisted.websocket.WampWebSocketClientProtocol.connectionLost方法的典型用法代码示例。如果您正苦于以下问题:Python WampWebSocketClientProtocol.connectionLost方法的具体用法?Python WampWebSocketClientProtocol.connectionLost怎么用?Python WampWebSocketClientProtocol.connectionLost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autobahn.twisted.websocket.WampWebSocketClientProtocol的用法示例。


在下文中一共展示了WampWebSocketClientProtocol.connectionLost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectionLost

# 需要导入模块: from autobahn.twisted.websocket import WampWebSocketClientProtocol [as 别名]
# 或者: from autobahn.twisted.websocket.WampWebSocketClientProtocol import connectionLost [as 别名]
    def connectionLost(self, reason):
        self.log.warn("Process connection gone: {reason}", reason=reason.value)

        WampWebSocketClientProtocol.connectionLost(self, reason)
        self.factory.proto = None

        if isinstance(reason.value, ProcessTerminated):
            if not self.factory._on_ready.called:
                # the worker was never ready in the first place ..
                self.factory._on_ready.errback(reason)
            else:
                # the worker _did_ run (was ready before), but now exited with error
                if not self.factory._on_exit.called:
                    self.factory._on_exit.errback(reason)
                else:
                    self.log.error("unhandled code path (1) in WorkerClientProtocol.connectionLost: {reason}", reason=reason.value)
        elif isinstance(reason.value, ProcessDone) or isinstance(reason.value, ConnectionDone):
            # the worker exited cleanly
            if not self.factory._on_exit.called:
                self.factory._on_exit.callback(None)
            else:
                self.log.error("unhandled code path (2) in WorkerClientProtocol.connectionLost: {reason}", reason=reason.value)
        else:
            # should not arrive here
            self.log.error("unhandled code path (3) in WorkerClientProtocol.connectionLost: {reason}", reason=reason.value)
开发者ID:RaitoBezarius,项目名称:crossbar,代码行数:27,代码来源:native.py

示例2: connectionLost

# 需要导入模块: from autobahn.twisted.websocket import WampWebSocketClientProtocol [as 别名]
# 或者: from autobahn.twisted.websocket.WampWebSocketClientProtocol import connectionLost [as 别名]
         def connectionLost(self, reason):
            WampWebSocketClientProtocol.connectionLost(self, reason)
            self.factory.proto = None

            log.msg("Worker {}: Process connection gone ({})".format(self._pid, reason.value))

            if isinstance(reason.value, ProcessTerminated):
               if not ready.called:
                  ## the worker was never ready in the first place ..
                  ready.errback(reason)
               else:
                  ## the worker _did_ run (was ready before), but now exited with error
                  if not exit.called:
                     exit.errback(reason)
                  else:
                     log.msg("FIXME: unhandled code path (1) in WorkerClientProtocol.connectionLost", reason.value)
            elif isinstance(reason.value, ProcessDone) or isinstance(reason.value, ConnectionDone):
               ## the worker exited cleanly
               if not exit.called:
                  exit.callback()
               else:
                  log.msg("FIXME: unhandled code path (2) in WorkerClientProtocol.connectionLost", reason.value)
            else:
               ## should not arrive here
               log.msg("FIXME: unhandled code path (3) in WorkerClientProtocol.connectionLost", reason.value)
开发者ID:rogererens,项目名称:crossbar,代码行数:27,代码来源:node.py


注:本文中的autobahn.twisted.websocket.WampWebSocketClientProtocol.connectionLost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。