forked from LBRYCommunity/lbry-sdk
fix incorrectly raised DownloadCanceledError for already verified blobs
-make InvalidDataError message clearer -fix BlobReflectorClient result
This commit is contained in:
parent
0cbe11b263
commit
679c2f403f
3 changed files with 10 additions and 9 deletions
|
@ -21,7 +21,7 @@ at anytime.
|
||||||
*
|
*
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
*
|
* incorrectly raised download cancelled error for already verified blob files
|
||||||
*
|
*
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -176,17 +176,18 @@ class BlobFile(object):
|
||||||
d.addCallbacks(lambda _: fire_finished_deferred(), errback_finished_deferred)
|
d.addCallbacks(lambda _: fire_finished_deferred(), errback_finished_deferred)
|
||||||
d.addCallback(lambda _: cancel_other_downloads())
|
d.addCallback(lambda _: cancel_other_downloads())
|
||||||
else:
|
else:
|
||||||
errback_finished_deferred(Failure(DownloadCanceledError()))
|
d = defer.succeed(None)
|
||||||
d = defer.succeed(True)
|
fire_finished_deferred()
|
||||||
else:
|
else:
|
||||||
err_string = "length vs expected: {0}, {1}, hash vs expected: {2}, {3}"
|
if writer.len_so_far != self.length:
|
||||||
err_string = err_string.format(self.length, writer.len_so_far, self.blob_hash,
|
err_string = "blob length is %i vs expected %i" % (writer.len_so_far, self.length)
|
||||||
writer.blob_hash)
|
else:
|
||||||
|
err_string = "blob hash is %s vs expected %s" % (writer.blob_hash, self.blob_hash)
|
||||||
errback_finished_deferred(Failure(InvalidDataError(err_string)))
|
errback_finished_deferred(Failure(InvalidDataError(err_string)))
|
||||||
d = defer.succeed(True)
|
d = defer.succeed(None)
|
||||||
else:
|
else:
|
||||||
errback_finished_deferred(err)
|
errback_finished_deferred(err)
|
||||||
d = defer.succeed(True)
|
d = defer.succeed(None)
|
||||||
d.addBoth(lambda _: writer.close_handle())
|
d.addBoth(lambda _: writer.close_handle())
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class BlobReflectorClient(Protocol):
|
||||||
self.factory.sent_blobs = self.sent_blobs
|
self.factory.sent_blobs = self.sent_blobs
|
||||||
if self.factory.sent_blobs:
|
if self.factory.sent_blobs:
|
||||||
log.info('Finished sending data via reflector')
|
log.info('Finished sending data via reflector')
|
||||||
self.factory.finished_deferred.callback(True)
|
self.factory.finished_deferred.callback(self.factory.sent_blobs)
|
||||||
else:
|
else:
|
||||||
log.info('Reflector finished: %s', reason)
|
log.info('Reflector finished: %s', reason)
|
||||||
self.factory.finished_deferred.callback(reason)
|
self.factory.finished_deferred.callback(reason)
|
||||||
|
|
Loading…
Reference in a new issue