本文整理匯總了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