本文整理汇总了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()
示例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()
示例3: callback
def callback(results):
reactor.stop()
for success, result in results:
if success:
print ElementTree.dump(result)
else:
print result.printTraceback()
示例4: clientConnectionFailed
def clientConnectionFailed(self, connector, reason):
'''
called when tcp connection attemp failed!
'''
print "connection failed: %s" % reason
reactor.stop()
示例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)
示例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()
示例7: terminate
def terminate(self):
# join the CheckChannelStreamRepeat thread
self.thread.do_run = False
self.thread.join()
self.close_commands()
reactor.stop()
示例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)
示例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()
示例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()
示例11: stop
def stop(self):
"""
停止代理服务器
:return:
"""
print('停止监听端口{}, 停止代理服务器'.format(self._port))
reactor.stop()
示例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
示例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()
示例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)
示例15: stop
def stop(self,dummy=None):
"""
Exit routine; stops twisted reactor
"""
print "Closing Python Manager"
reactor.stop()
print "Done"