Rev505, FindHashIds also checks in self hashfield, Fix optional file bug when task already finished, Reset peer last hashfield download time when found hashid using findHashIds

This commit is contained in:
HelloZeroNet 2015-10-28 01:28:29 +01:00
parent 5f0266ed8f
commit 9c5fda6ed2
4 changed files with 26 additions and 4 deletions

View file

@ -186,6 +186,8 @@ class WorkerManager:
task = [task for task in self.tasks if task["optional_hash_id"] == hash_id]
if task: # Found task, lets take the first
task = task[0]
else:
continue
for peer_ip in peer_ips:
peer = self.site.addPeer(peer_ip[0], peer_ip[1], return_peer=True)
if not peer:
@ -194,7 +196,8 @@ class WorkerManager:
task["peers"] = []
if peer not in task["peers"]:
task["peers"].append(peer)
peer.hashfield.appendHashId(hash_id) # Peer has this file
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