stop requesting peers which doesnt have a blob

This commit is contained in:
Victor Shyba 2018-07-13 01:21:24 -03:00 committed by Jack Robison
parent 7f6bbc0648
commit 5492ab9081
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -354,6 +354,10 @@ class AvailabilityRequest(RequestHelper):
log.debug("Received a response to the availability request") log.debug("Received a response to the availability request")
# save available blobs # save available blobs
blob_hashes = response_dict['available_blobs'] blob_hashes = response_dict['available_blobs']
if not blob_hashes:
# should not send any more requests as it doesnt have any blob we need
self.peer.update_score(-10.0)
return True
for blob_hash in blob_hashes: for blob_hash in blob_hashes:
if blob_hash in request.request_dict['requested_blobs']: if blob_hash in request.request_dict['requested_blobs']:
self.process_available_blob_hash(blob_hash, request) self.process_available_blob_hash(blob_hash, request)