• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python reactor.crash函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.internet.reactor.crash函数的典型用法代码示例。如果您正苦于以下问题:Python crash函数的具体用法?Python crash怎么用?Python crash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: gotOutput

  def gotOutput(self, node, sender, data):
    global success

    if self.expected.get(node) == None:
      self.expected[node] = 0

    if (self.expected.get(node, int(data)) != int(data)):
      print "Got " + data.rstrip() + " instead of " + \
             str(self.expected[node]) + " from "  + node.name

      success = False
      reactor.crash()

    if not sender in node.peers:
      print "Sender " + sender + " not in node peers"
      success = False
      reactor.crash()

    self.expected[node] = int(data) + 1

    if self.expected[node] == 10:
      self.done += 1

    if self.done == NUMNODES - 1:
      for x in self.nodes:
        x.stats()
      self.nodes[-1].disconnect()
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-salut,代码行数:27,代码来源:simplemeshtest.py


示例2: gotOutput

  def gotOutput(self, node, sender, data):
    global success

    if sender == "retriever":
      return

    if self.expected.get(node) == None:
      self.expected[node] = 0

    if (self.expected.get(node, int(data)) != int(data)):
      print "Got " + data.rstrip() + " instead of " + \
             str(self.expected[node]) + " from "  + node.name

      success = False
      reactor.crash()

    if not sender in node.peers:
      print "Sender " + sender + " not in node peers"
      success = False
      reactor.crash()

    self.expected[node] = int(data) + 1

    if self.expected[node] == 10:
      self.done += 1
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-salut,代码行数:25,代码来源:repair-after-node-disconnected-test.py


示例3: OnTimeout

	def OnTimeout( self ):
		"""On a timeout condition, raise an error"""
		if not self.finished:
			self.finished = 1
			self.result = defer.TimeoutError('SNMP request timed out')
			self.success = 0
		reactor.crash()
开发者ID:mmattice,项目名称:TwistedSNMP,代码行数:7,代码来源:synchronous.py


示例4: receiveError

 def receiveError(self, reasonCode, desc):
     global theTest
     reactor.crash()
     self.expectedLoseConnection = 1
     if not self.allowedToError:
         theTest.fail('got disconnect for %s: reason %s, desc: %s' %
                        (self, reasonCode, desc))
开发者ID:fxia22,项目名称:ASM_xf,代码行数:7,代码来源:test_conch.py


示例5: _failTest

 def _failTest():
     fac.proto.transport.loseConnection()
     cfac.client.transport.loseConnection()
     reactor.iterate(0.1)
     reactor.iterate(0.1)
     reactor.iterate(0.1)
     reactor.crash()
     self.fail('test took too long')
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:test_conch.py


示例6: getChannel

 def getChannel(self, ct, ws, mp, d):
     if ct != 'session':
         global theTest
         theTest.fail('should not get %s as a channel type' % ct)
         reactor.crash()
     return SSHTestServerSession(remoteWindow = ws,
                                 remoteMaxPacket = mp,
                                 conn = self)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:test_conch.py


示例7: results_received

 def results_received(results):
     global external_command
     external_command.shutdown()
     # Give threads time to finish
     sleep(0.05)
     if not results == ('foo', 'bar'):
         exit(1)
     reactor.crash()
开发者ID:BackupTheBerlios,项目名称:sippy,代码行数:8,代码来源:External_command.py


示例8: command_received

 def command_received(self, clm, cmd):
     try:
         self.file_out.write(cmd + '\n')
         self.file_out.flush()
     except:
         self.rval = 1
         reactor.crash()
         return
开发者ID:JustRight,项目名称:rtpproxy,代码行数:8,代码来源:rtpp_notify_client.py


示例9: subtest_done

 def subtest_done(self, subtest):
     self.nsubtests_running -= 1
     if subtest.rval == 0:
         self.rval -= 1
     if self.nsubtests_running == 0:
         if self.rval == 1:
             self.rval = 0
         reactor.crash()
开发者ID:hongbinz,项目名称:voiptests,代码行数:8,代码来源:b_test1.py


示例10: exec_test_deferred

def exec_test_deferred (funs, params, protocol=None, timeout=None):
    colourer = None

    if sys.stdout.isatty():
        colourer = install_colourer()

    queue = servicetest.IteratingEventQueue(timeout)
    queue.verbose = (
        os.environ.get('CHECK_TWISTED_VERBOSE', '') != ''
        or '-v' in sys.argv)

    bus = dbus.SessionBus()

    sim = Simulator()

    bus.add_signal_receiver(
        lambda *args, **kw:
            queue.append(
                Event('dbus-signal',
                    path=unwrap(kw['path']),
                    signal=kw['member'], args=map(unwrap, args),
                    interface=kw['interface'])),
        None,       # signal name
        None,       # interface
        None,
        path_keyword='path',
        member_keyword='member',
        interface_keyword='interface',
        byte_arrays=True
        )

    try:
        for f in funs:
            conn = make_connection(bus, queue.append, params)
            f(queue, bus, conn)
    except Exception:
        import traceback
        traceback.print_exc()

    try:
        if colourer:
          sys.stdout = colourer.fh
        reactor.crash()

        # force Disconnect in case the test crashed and didn't disconnect
        # properly.  We need to call this async because the BaseIRCServer
        # class must do something in response to the Disconnect call and if we
        # call it synchronously, we're blocking ourself from responding to the
        # quit method.
        servicetest.call_async(queue, conn, 'Disconnect')

        if 'RING_TEST_REFDBG' in os.environ:
            # we have to wait for the timeout so the process is properly
            # exited and refdbg can generate its report
            time.sleep(5.5)

    except dbus.DBusException:
        pass
开发者ID:jusa,项目名称:telepathy-ring,代码行数:58,代码来源:ringtest.py


示例11: buildProtocol

 def buildProtocol(self, addr):
     if hasattr(self, 'proto'):
         global theTest
         reactor.crash()
         theTest.fail('connected twice to factory')
     self.proto = SSHTestServer()
     self.proto.supportedPublicKeys = self.privateKeys.keys()
     self.proto.factory = self
     return self.proto
开发者ID:fxia22,项目名称:ASM_xf,代码行数:9,代码来源:test_conch.py


示例12: timedOut

    def timedOut(self):
        """I'm called when the safety timer expires indicating test probably won't complete"""

        # FIXME: how do we cancel this test and cleanup remaining deferreds?
        self.pending_deferreds = []

        if debug:
            "**** timedOut callback, test did not complete"
        self.fail("Safety timeout callback ... test did not complete")
        reactor.crash()
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:10,代码来源:test_deviceserver.py


示例13: stop

def stop(ignored=None, connector=None):
    if isinstance(ignored, Exception):
        raise ignored
    if reactor.running:
        if getattr(reactor, 'threadpool', None) is not None:
            reactor.threadpool.stop()
            reactor.threadpool = None
        reactor.crash()
    if connector:
        connector.disconnect()
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:10,代码来源:testZenHub.py


示例14: gotReply

    def gotReply(reply):
        if reply != [b"REP: REQ1"]:
            print("Unexpected reply: %r" % (reply, ))

            global exitCode
            exitCode = 1
            reactor.crash()
            return

        print("OK")
        reactor.crash()
开发者ID:brunsgaard,项目名称:txZMQ,代码行数:11,代码来源:integration_test.py


示例15: got_result

 def got_result(self, result):
     if self.fout != None:
         try:
             self.fout.write("%s\n" % result)
             self.fout.flush()
         except:
             self.rval = 1
             reactor.crash()
             return
     self.responses.append(result)
     self.issue_next_cmd()
开发者ID:zhongz,项目名称:rtpproxy,代码行数:11,代码来源:rtpp_query.py


示例16: on_timeout

        def on_timeout(d):
            e = defer.TimeoutError("(%s) still running at %s secs" % (method.__name__, timeout))
            f = failure.Failure(e)

            try:
                d.errback(f)
            except defer.AlreadyCalledError:
                # if the deferred has been called already but the *back chain
                # is still unfinished, crash the reactor and report timeout
                # error ourself.
                reactor.crash()
                raise
开发者ID:mtytel,项目名称:Tron,代码行数:12,代码来源:testingutils.py


示例17: quit

 def quit(sig, frame):
     print "Received signal %s, quitting" % sig
     global masterProcess
     global slaveProcesses
     
     for process in [masterProcess] + slaveProcesses:
         process.terminate()
     
     try:
         reactor.crash()
     except:
         pass
开发者ID:unshift,项目名称:thundercloud,代码行数:12,代码来源:standalone.py


示例18: issue_next_cmd

 def issue_next_cmd(self):
     if self.commands != None:
         if len(self.commands) == 0:
             reactor.crash()
             return
         command = self.commands.pop(0)
     else:
         command = self.fin.readline()
         if command == None or len(command) == 0:
             reactor.crash()
             return
     self.rc.send_command(command, self.got_result)
开发者ID:zhongz,项目名称:rtpproxy,代码行数:12,代码来源:rtpp_query.py


示例19: stop

 def stop(self):
     self._log.debug( 'stop' )
     from twisted.internet import reactor
     reactor.callFromThread( reactor.stop )
     maxSleep = 15
     while self.__running and maxSleep > 0:
         time.sleep(1)
         maxSleep = maxSleep - 1
     reactor.crash()
     
     self._tlog.stop()
     self._tlog = None
开发者ID:AndyThirtover,项目名称:wb_gateway,代码行数:12,代码来源:TwistedReactor.py


示例20: request_exit_status

 def request_exit_status(self, status):
     status = struct.unpack('>L', status)[0]
     if status == 0:
         global theTest
         theTest.fail('false exit status was 0')
         reactor.crash()
     self.conn.results +=1
     log.msg('finished false')
     if self.conn.results == 3: # all tests run
         self.conn.transport.expectedLoseConnection = 1
         theTest.fac.proto.expectedLoseConnection = 1
         self.loseConnection()
         reactor.crash()
     return 1
开发者ID:fxia22,项目名称:ASM_xf,代码行数:14,代码来源:test_conch.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reactor.fireSystemEvent函数代码示例发布时间:2022-05-27
下一篇:
Python reactor.connectUNIX函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap