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

Python reactor.stop函数代码示例

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

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



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


示例16: _stuned

    def _stuned(ip):
        if stun.getUDPClient() is None:
            print 'UDP CLIENT IS NONE - EXIT'
            reactor.stop()
            return

        print '+++++ EXTERNAL UDP ADDRESS IS', stun.getUDPClient().externalAddress
        
        if sys.argv[1] == 'listen':
            print '+++++ START LISTENING'
            return
        
        if sys.argv[1] == 'connect':
            print '+++++ CONNECTING TO REMOTE MACHINE'
            _try2connect()
            return

        lid = misc.getLocalIdentity()
        udp_contact = 'udp://'+stun.getUDPClient().externalAddress[0]+':'+str(stun.getUDPClient().externalAddress[1])
        lid.setProtoContact('udp', udp_contact)
        lid.sign()
        misc.setLocalIdentity(lid)
        misc.saveLocalIdentity()
        
        print '+++++ UPDATE IDENTITY', str(lid.contacts)
        _send_servers().addBoth(_id_sent)
开发者ID:vesellov,项目名称:datahaven,代码行数:26,代码来源:transport_udp.py


示例17: setup_complete

def setup_complete(config):
    print "Got config"
    keys = config.config.keys()
    keys.sort()
    defaults = []
    for k in keys:
        if k == 'HiddenServices':
            for hs in config.config[k]:
                for xx in ['dir', 'version', 'authorize_client']:
                    if getattr(hs, xx):
                        print 'HiddenService%s %s' % (xx.capitalize(),
                                                      getattr(hs, xx))
                for port in hs.ports:
                    print 'HiddenServicePort', port
            continue

        v = getattr(config, k)
        if isinstance(v, types.ListType):
            for val in v:
                if val != DEFAULT_VALUE:
                    print k, val

        elif v == DEFAULT_VALUE:
            defaults.append(k)

        else:
            print k, v

    if 'defaults' in sys.argv:
        print "Set to default value:"
        for k in defaults:
            print "# %s" % k

    reactor.stop()
开发者ID:Ryman,项目名称:txtorcon,代码行数:34,代码来源:dump_config.py


示例18: _failure

 def _failure(self, why):
     from twisted.internet import reactor
     from buildbot_worker.scripts.logwatcher import WorkerTimeoutError
     if why.check(WorkerTimeoutError):
         print(rewrap("""\
             The worker took more than 10 seconds to start and/or connect
             to the buildmaster, so we were unable to confirm that it
             started and connected correctly.
             Please 'tail twistd.log' and look for a line that says
             'message from master: attached' to verify correct startup.
             If you see a bunch of messages like 'will retry in 6 seconds',
             your worker might not have the correct hostname or portnumber
             for the buildmaster, or the buildmaster might not be running.
             If you see messages like
                'Failure: twisted.cred.error.UnauthorizedLogin'
             then your worker might be using the wrong botname or password.
             Please correct these problems and then restart the worker.
             """))
     else:
         print(rewrap("""\
             Unable to confirm that the worker started correctly.
             You may need to stop it, fix the config file, and restart.
             """))
         print(why)
     self.rc = 1
     reactor.stop()
开发者ID:Cray,项目名称:buildbot,代码行数:26,代码来源:start.py


示例19: single_shot_main

def single_shot_main(args):
    try:
        client = WinrsClient(args.remote, args.username, args.password)
        results = yield client.run_command(args.command)
        pprint(results)
    finally:
        reactor.stop()
开发者ID:Hackman238,项目名称:txwinrm,代码行数:7,代码来源:winrs.py


示例20: quit

 def quit(self, exit_value=0, with_restart=False):
     """Shutdown and stop the reactor."""
     yield self.shutdown(with_restart)
     if reactor.running:
         reactor.stop()
     else:
         sys.exit(exit_value)
开发者ID:magicicada-bot,项目名称:magicicada-client,代码行数:7,代码来源:main.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python reactor.suggestThreadPoolSize函数代码示例发布时间:2022-05-27
下一篇:
Python reactor.spawnProcess函数代码示例发布时间: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