Pass file info for addTask call
This commit is contained in:
parent
f45c0b2377
commit
c91011e6ea
2 changed files with 5 additions and 4 deletions
|
@ -760,11 +760,11 @@ class Site(object):
|
|||
self.log.debug("%s: Download not allowed" % inner_path)
|
||||
return False
|
||||
|
||||
task = self.worker_manager.addTask(inner_path, peer, priority=priority)
|
||||
task = self.worker_manager.addTask(inner_path, peer, priority=priority, file_info=file_info)
|
||||
if blocking:
|
||||
return task["evt"].get()
|
||||
else:
|
||||
return task
|
||||
return task["evt"]
|
||||
|
||||
# Add or update a peer to site
|
||||
# return_peer: Always return the peer even if it was already present
|
||||
|
|
|
@ -409,7 +409,7 @@ class WorkerManager(object):
|
|||
return 0
|
||||
|
||||
# Create new task and return asyncresult
|
||||
def addTask(self, inner_path, peer=None, priority=0):
|
||||
def addTask(self, inner_path, peer=None, priority=0, file_info=None):
|
||||
self.site.onFileStart(inner_path) # First task, trigger site download started
|
||||
task = self.findTask(inner_path)
|
||||
if task: # Already has task for that file
|
||||
|
@ -431,7 +431,8 @@ class WorkerManager(object):
|
|||
peers = [peer] # Only download from this peer
|
||||
else:
|
||||
peers = None
|
||||
file_info = self.site.content_manager.getFileInfo(inner_path)
|
||||
if not file_info:
|
||||
file_info = self.site.content_manager.getFileInfo(inner_path)
|
||||
if file_info and file_info["optional"]:
|
||||
optional_hash_id = helper.toHashId(file_info["sha512"])
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue