本文整理汇总了Python中Requester.Requester.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Requester.reset方法的具体用法?Python Requester.reset怎么用?Python Requester.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requester.Requester
的用法示例。
在下文中一共展示了Requester.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Requester import Requester [as 别名]
# 或者: from Requester.Requester import reset [as 别名]
#.........这里部分代码省略.........
self.log.debug("Removing us from choker")
self.choker.removeTorrent(self.torrentIdent)
self.log.debug("Removing us from connection builder")
self.connBuilder.removeTorrent(self.torrentIdent)
self.log.debug("Removing us from connection listener")
self.connListener.removeTorrent(self.torrent.getTorrentHash())
self.log.debug("Removing us from connection handler")
self.connHandler.removeTorrent(self.torrentIdent)
self.log.debug("Stopping transfer measurement")
self.inRate.stop()
self.outRate.stop()
#shutdown/removal specific tasks which need to be done regardless of current status
if targetState in ('shutdown', 'remove'):
self.log.debug("Removing all infos related to us from connection pool")
self.peerPool.clear(self.torrentIdent)
if targetState == 'remove':
self.log.debug('Removing all persisted objects of this torrent')
self.btPersister.removeAll()
##internal functions - start/pause/stop - specific
def _start(self, loadSuccess):
try:
if loadSuccess:
#loading was successful, add to handlers
self.log.debug("Reseting requester")
self.requester.reset()
self.log.debug("Starting transfer measurement")
self.inRate.start()
self.outRate.start()
self.log.debug("Adding us to connection handler")
self.connHandler.addTorrent(self.torrentIdent, self.torrent, self.pieceStatus, self.inRate, self.outRate, self.storage, self.filePrio, self.requester, self.superSeedingHandler)
self.log.debug("Adding us to connection listener")
self.connListener.addTorrent(self.torrentIdent, self.torrent.getTorrentHash())
self.log.debug("Adding us to connection builder")
self.connBuilder.addTorrent(self.torrentIdent, self.torrent.getTorrentHash())
self.log.debug("Adding us to choker")
self.choker.addTorrent(self.torrentIdent, self.storage.getStatus(), self.superSeedingHandler)
self.log.debug("Starting tracker requester")
self.trackerRequester.start()
self.started = True
self.state = 'running'
except:
#something failed - hard
self.log.error("Error in load function:\n%s", logTraceback())
##external functions - state
def start(self):
#called when torrent is started