本文整理汇总了Python中twisted.internet.protocol.ServerFactory.doStop方法的典型用法代码示例。如果您正苦于以下问题:Python ServerFactory.doStop方法的具体用法?Python ServerFactory.doStop怎么用?Python ServerFactory.doStop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.protocol.ServerFactory
的用法示例。
在下文中一共展示了ServerFactory.doStop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doStop
# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import doStop [as 别名]
def doStop(self, cv=None):
"""
Stops imap service (fetcher, factory and port).
:param cv: A condition variable to which we can signal when imap
indeed stops.
:type cv: threading.Condition
:return: a Deferred that stops and flushes the in memory store data to
disk in another thread.
:rtype: Deferred
"""
if DO_PROFILE:
log.msg("Stopping PROFILING")
pr.disable()
pr.dump_stats(PROFILE_DAT)
ServerFactory.doStop(self)
if cv is not None:
def _stop_imap_cb():
logger.debug('Stopping in memory store.')
self._memstore.stop_and_flush()
while not self._memstore.producer.is_queue_empty():
logger.debug('Waiting for queue to be empty.')
# TODO use a gatherResults over the new/dirty
# deferred list,
# as in memorystore's expunge() method.
time.sleep(1)
# notify that service has stopped
logger.debug('Notifying that service has stopped.')
cv.acquire()
cv.notify()
cv.release()
return threads.deferToThread(_stop_imap_cb)
示例2: doStop
# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import doStop [as 别名]
def doStop(self):
"""
Stops imap service (fetcher, factory and port).
"""
# mark account as unusable, so any imap command will fail
# with unauth state.
self.theAccount.end_session()
# TODO should wait for all the pending deferreds,
# the twisted way!
if DO_PROFILE:
log.msg("Stopping PROFILING")
pr.disable()
pr.dump_stats(PROFILE_DAT)
return ServerFactory.doStop(self)
示例3: doStop
# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import doStop [as 别名]
def doStop(self):
"""
Stops imap service (fetcher, factory and port).
"""
return ServerFactory.doStop(self)
示例4: doStop
# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import doStop [as 别名]
def doStop(self):
debug( "Stopping factory." )
ServerFactory.doStop(self)
示例5: doStop
# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import doStop [as 别名]
def doStop(self):
self.wrappedFactory.doStop()
ServerFactory.doStop(self)