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


Python reactor.stop函数代码示例

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


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

示例1: gotList

def gotList(mappings):
    mappings = [ ((x[0][0],int(x[0][1]),x[1])) for x in mappings.items()]
    mappings.sort()
    for prot,port,ddict in mappings:
        desc = mappingDesc%ddict
        print "%s/%d -> %s"%(prot,port,desc)
    reactor.stop()
开发者ID:braams,项目名称:shtoom,代码行数:7,代码来源:upnpclient.py

示例2: command_result

    def command_result(command_st):

        commands = command_st.strip().split()

        if(len(commands) > 1):

            op = commands[0]

            key = str(commands[1])

            print "####KEY", key

            if(len(commands) > 2):
                value = commands[2].encode('ascii', 'ignore')

            if op == "q":

                reactor.stop()

            elif op == "set":

                print "adding key:", key, "-->", value
                server.set(key, value).addCallback(set_done, server)

            elif op == "get":

                print "getting key:", key

                server.get(key).addCallback(get_done, server)

            else:

                print "command: ",command_st," is wrong format"

        get_input()
开发者ID:bravandi,项目名称:CS505FinalProject,代码行数:35,代码来源:client.py

示例3: callback

 def callback(results):
     reactor.stop()
     for success, result in results:
         if success:
             print ElementTree.dump(result)
         else:
             print result.printTraceback()
开发者ID:alexandrud,项目名称:ZenPacks.zenoss.oVirt,代码行数:7,代码来源:txovirt.py

示例4: clientConnectionFailed

	def clientConnectionFailed(self, connector, reason):
		'''
		called when tcp connection attemp failed!
		'''
		
		print "connection failed: %s" % reason
		reactor.stop()
开发者ID:sprungknoedl,项目名称:python-workshop,代码行数:7,代码来源:ircbot.py

示例5: quit

    def quit(self, shutdown=False):
        """
        Quits the GtkUI

        :param shutdown: whether or not to shutdown the daemon as well
        :type shutdown: boolean
        """
        if shutdown:

            def on_daemon_shutdown(result):
                try:
                    reactor.stop()
                except ReactorNotRunning:
                    log.debug("Attempted to stop the reactor but it is not running...")

            client.daemon.shutdown().addCallback(on_daemon_shutdown)
            return
        if client.is_classicmode():
            reactor.stop()
            return
        if not client.connected():
            reactor.stop()
            return

        def on_client_disconnected(result):
            reactor.stop()

        client.disconnect().addCallback(on_client_disconnected)
开发者ID:NoGare,项目名称:deluge1,代码行数:28,代码来源:mainwindow.py

示例6: handleCmd_EOS

    def handleCmd_EOS(self, prefix, args):
        if prefix != self.server_name:
            return
        if self.ism.syncd:
            return

        LOG.info("Finished receiving IRC sync data.")

        self.showirc = True

        # Check for conflicting bridges.
        if self.ism.findConflictingBridge():
            LOG.error("My nick prefix is in use! Terminating.")
            self.transport.loseConnection()
            reactor.stop()
            return

        # Set up nick reservation
        scfg = getServiceConfig()
        self.sendLine(
            "TKL + Q * %s* %s 0 %d :Reserved for Dtella" %
            (cfg.dc_to_irc_prefix, scfg.my_host, time.time()))
        self.ism.killConflictingUsers()

        # Send my own bridge nick
        self.pushBotJoin(do_nick=True)

        # When we enter the syncd state, register this instance with Dtella.
        # This will eventually trigger event_DtellaUp, where we send our state.
        self.schedulePing()
        self.ism.addMeToMain()
开发者ID:Achilles-96,项目名称:dtella,代码行数:31,代码来源:unreal.py

示例7: terminate

    def terminate(self):
        # join the CheckChannelStreamRepeat thread
        self.thread.do_run = False
        self.thread.join()

        self.close_commands()
        reactor.stop()
开发者ID:leafwind,项目名称:SimpleTwitchBot,代码行数:7,代码来源:bot.py

示例8: check_counters_and_stop

 def check_counters_and_stop(self):
      if len(self.counters) >= self.number_counters:
         reactor.stop()
         echo('OUT')
      else:
          echo("{0} {1}".format(count, stack()[0][3]))
          reactor.callLater(.5, self.check_counters_and_stop)
开发者ID:compfaculty,项目名称:TeachMePython,代码行数:7,代码来源:countdown_twisted.py

示例9: game_loop

def game_loop():
	
	#Networking
	sent_data = datagrabber.grab()
	if sent_data != None:
		print sent_data

	#Logic
	if mo.quit():
		tick.stop()
		reactor.stop()

	if rtrn.pressed():
		hand.cards[0].flip()

	#Animation
	#

	#Video
	mo.window.clear(mo.sf.Color.WHITE)
	#
	hand.draw()
	opponent.draw()
	#
	mo.window.display()
开发者ID:FuzzWool,项目名称:smashbros_tcg,代码行数:25,代码来源:test1.py

示例10: processEnded

 def processEnded(self, reason):
     if isinstance(reason.value, ProcessTerminated):
         self._exit_status = reason.value.status
     if isinstance(reason.value, ProcessDone):
         self._exit_status = reason.value.status
     self._process = None
     reactor.stop()
开发者ID:Wawki,项目名称:minion-backend,代码行数:7,代码来源:tasks.py

示例11: stop

 def stop(self):
     """
     停止代理服务器
     :return:
     """
     print('停止监听端口{}, 停止代理服务器'.format(self._port))
     reactor.stop()
开发者ID:leo-py,项目名称:ms-rdp-nat-traverse,代码行数:7,代码来源:server.py

示例12: errback

 def errback(error):
     if isinstance(error, Failure):
         self.log.critical( "Invalid monitor: %s" % self.options.monitor)
         reactor.stop()
         return defer.fail(RemoteBadMonitor(
                    "Invalid monitor: %s" % self.options.monitor, ''))
     return error
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:7,代码来源:PBDaemon.py

示例13: err_cb

 def err_cb(failure):
     failure.trap(Exception)
     logging.error("Error: {0}".format(failure))
     if args['debug']:
         traceback.print_exc()
     if reactor.running:
         reactor.stop()
开发者ID:allmende,项目名称:indx,代码行数:7,代码来源:client.py

示例14: dataReceived

    def dataReceived(self, data):
        # TOFIX: Figure out how to get this method to work.
        # if not self.known_proto:
            # self.known_proto = True
            # assert self.known_proto == b'h2'

        events = self.conn.receive_data(data)

        for event in events:
            self.messageHandler.storeEvent(event)
            if isinstance(event, ResponseReceived):
                self.handleResponse(event.headers, event.stream_id)
            elif isinstance(event, DataReceived):
                self.handleData(event.data, event.stream_id)
            elif isinstance(event, StreamEnded):
                self.endStream(event.stream_id)
            elif isinstance(event, SettingsAcknowledged):
                self.settingsAcked(event)
            elif isinstance(event, StreamReset):
                reactor.stop()
                raise RuntimeError("Stream reset: %d" % event.error_code)
            else:
                print(event)

        data = self.conn.data_to_send()
        if data:
            self.transport.write(data)
开发者ID:pbsugg,项目名称:http2-frame-visualizer,代码行数:27,代码来源:twisted_client.py

示例15: stop

 def stop(self,dummy=None):
     """
     Exit routine; stops twisted reactor
     """
     print "Closing Python Manager"
     reactor.stop()        
     print "Done"
开发者ID:craigprice,项目名称:XTSM_1,代码行数:7,代码来源:XTSMserver_081014.py


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