projects
/
tahoe-lafs
/
tahoe-lafs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0dc26e
)
download.py: don't truncate tail segments that are the same size as all the others
author
Brian Warner
<warner@allmydata.com>
Tue, 17 Apr 2007 20:39:35 +0000
(13:39 -0700)
committer
Brian Warner
<warner@allmydata.com>
Tue, 17 Apr 2007 20:39:35 +0000
(13:39 -0700)
src/allmydata/download.py
patch
|
blob
|
history
diff --git
a/src/allmydata/download.py
b/src/allmydata/download.py
index 1861d75d2145de0e9d7637b02fbe9251de3c9a00..e668dde80d28e3ba97cc075de59b39e927181150 100644
(file)
--- a/
src/allmydata/download.py
+++ b/
src/allmydata/download.py
@@
-323,7
+323,10
@@
class FileDownloader:
def _done(res):
# trim off any padding added by the upload side
data = ''.join(res)
- tail_size = self._size % self._segment_size
+ # we never send empty segments. If the data was an exact multiple
+ # of the segment size, the last segment will be full.
+ pad_size = mathutil.pad_size(self._size, self._segment_size)
+ tail_size = self._segment_size - pad_size
self._output.write(data[:tail_size])
d.addCallback(_done)
return d