Merge pull request #932 from lbryio/fix_reflector_client

Reflector client bug
This commit is contained in:
Umpei Kay Kurokawa 2017-10-03 15:18:16 -04:00 committed by GitHub
commit a13b8eee40
2 changed files with 6 additions and 4 deletions

View file

@ -21,6 +21,7 @@ at anytime.
* Fixed redundant blob requests to a peer
* Fixed https://github.com/lbryio/lbry/issues/923
* Fixed concurrent reflects opening too many files
* Fixed cases when reflecting would fail on error conditions
### Deprecated
* Deprecated `blob_announce_all` JSONRPC command. Use `blob_announce` instead.

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