mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
update the use of the encoder API in download.py
This commit is contained in:
parent
82a0cd6615
commit
c427b880d2
@ -113,19 +113,21 @@ class FileDownloader:
|
||||
# retrieve all shares
|
||||
dl = []
|
||||
shares = []
|
||||
shareids = []
|
||||
for (bucket_num, bucket) in all_buckets:
|
||||
d0 = bucket.callRemote("get_metadata")
|
||||
d1 = bucket.callRemote("read")
|
||||
d2 = DeferredListShouldSucceed([d0, d1])
|
||||
def _got(res):
|
||||
sharenum_s, sharedata = res
|
||||
sharenum = bencode.bdecode(sharenum_s)
|
||||
shares.append((sharenum, sharedata))
|
||||
shareid_s, sharedata = res
|
||||
shareid = bencode.bdecode(shareid_s)
|
||||
shares.append(sharedata)
|
||||
shareids.append(shareid)
|
||||
d2.addCallback(_got)
|
||||
dl.append(d2)
|
||||
d = DeferredListShouldSucceed(dl)
|
||||
|
||||
d.addCallback(lambda res: self._decoder.decode(shares))
|
||||
d.addCallback(lambda res: self._decoder.decode(shares, shareids))
|
||||
|
||||
def _write(decoded_shares):
|
||||
data = "".join(decoded_shares)
|
||||
|
Loading…
x
Reference in New Issue
Block a user