From: david-sarah Date: Tue, 16 Aug 2011 21:46:12 +0000 (-0700) Subject: mutable/retrieve.py: cosmetics and remove a stale comment. refs #393 X-Git-Tag: post-393~1 X-Git-Url: https://git.rkrishnan.org/listings/pb3user.py?a=commitdiff_plain;h=4b62b53cd68924dca0257c28937caca519da0a95;p=tahoe-lafs%2Ftahoe-lafs.git mutable/retrieve.py: cosmetics and remove a stale comment. refs #393 --- diff --git a/src/allmydata/mutable/retrieve.py b/src/allmydata/mutable/retrieve.py index cd67f836..595da73e 100644 --- a/src/allmydata/mutable/retrieve.py +++ b/src/allmydata/mutable/retrieve.py @@ -275,6 +275,7 @@ class Retrieve: self._started_fetching = time.time() self._add_active_peers() + # The download process beyond this is a state machine. # _add_active_peers will select the peers that we want to use # for the download, and then attempt to start downloading. After @@ -297,9 +298,9 @@ class Retrieve: """ # shnum => block hash tree. Unused, but setup_encoding_parameters will # want to set this. - # XXX: Make it so that it won't set this if we're just decoding. self._block_hash_trees = None self._setup_encoding_parameters() + # This is the form expected by decode. blocks_and_salts = blocks_and_salts.items() blocks_and_salts = [(True, [d]) for d in blocks_and_salts] @@ -399,10 +400,10 @@ class Retrieve: # segment that we were asked to read. self.log("got read length %d" % self._read_length) end_data = self._offset + self._read_length + # We don't actually need to read the byte at end_data, but # the one before it. - end_data = end_data - 1 - end = end_data // self._segment_size + end = (end_data - 1) // self._segment_size assert end < self._num_segments self._last_segment = end