Skip to content

Commit

Permalink
Don't retry failed peer on optional file search
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Nov 16, 2016
1 parent b220f5d commit 0e83eba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Worker/WorkerManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@ def findOptionalTasks(self, optional_tasks, reset_task=False):
for task in optional_tasks:
optional_hash_id = task["optional_hash_id"]
if optional_hash_id in hashfield_set:
if reset_task and len(task["failed"]) > 0:
task["failed"] = []
if peer in task["failed"]:
continue
found[optional_hash_id].append(peer)
if task["peers"] and peer not in task["peers"]:
task["peers"].append(peer)
else:
task["peers"] = [peer]
if reset_task and len(task["failed"]) > 0:
task["failed"] = []

return found

Expand Down Expand Up @@ -221,9 +223,9 @@ def addOptionalPeers(self, found_ips):
task["peers"] = []
if peer not in task["peers"]:
task["peers"].append(peer)
found[hash_id].append(peer)
if peer.hashfield.appendHashId(hash_id): # Peer has this file
peer.time_hashfield = None # Peer hashfield probably outdated
found[hash_id].append(peer)

return found

Expand Down

0 comments on commit 0e83eba

Please sign in to comment.