fix inconsistency in how blob_hashes_to_send is used, preventing proper reflecting

This commit is contained in:
Kay Kurokawa 2017-10-02 12:50:47 -04:00
parent 010a1019fe
commit 0a919c3eab

View file

@ -124,8 +124,8 @@ class EncryptedFileReflectorClient(Protocol):
def set_blobs_to_send(self, blobs_to_send):
for blob in blobs_to_send:
if blob not in self.blob_hashes_to_send:
self.blob_hashes_to_send.append(blob)
if blob.blob_hash not in self.blob_hashes_to_send:
self.blob_hashes_to_send.append(blob.blob_hash)
def get_blobs_to_send(self):
def _show_missing_blobs(filtered):
@ -308,9 +308,10 @@ class EncryptedFileReflectorClient(Protocol):
return d
elif self.blob_hashes_to_send:
# open the next blob to send
blob = self.blob_hashes_to_send[0]
blob_hash = self.blob_hashes_to_send[0]
self.blob_hashes_to_send = self.blob_hashes_to_send[1:]
d = self.open_blob_for_reading(blob)
d = self.blob_manager.get_blob(blob_hash)
d.addCallback(self.open_blob_for_reading)
d.addCallbacks(lambda _: self.send_blob_info(),
lambda err: self.skip_missing_blob(err, blob.blob_hash))
return d