From e14dcb92e27dac7f6f3a843f3378a1b7debdb800 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 28 Jan 2008 19:05:43 -0700 Subject: [PATCH] offloaded: when uploading a file that failed to upload before, ask for the last byte of ciphertext, so the reader is prepared to give us the plaintext hashes --- src/allmydata/offloaded.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py index 7549a4e7..6cb9f98a 100644 --- a/src/allmydata/offloaded.py +++ b/src/allmydata/offloaded.py @@ -164,7 +164,16 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin): if os.path.exists(self._encoding_file): self.log("ciphertext already present, bypassing fetch", level=log.UNUSUAL) - return self._done2() + # we'll still need the plaintext hashes (when + # LocalCiphertextReader.get_plaintext_hashtree_leaves() is + # called), and currently the easiest way to get them is to ask + # the sender for the last byte of ciphertext. That will provoke + # them into reading and hashing (but not sending) everything + # else. + have = os.stat(self._encoding_file)[stat.ST_SIZE] + d = self.call("read_encrypted", have-1, 1) + d.addCallback(lambda ignored: self._done2()) + return # first, find out how large the file is going to be d = self.call("get_size") @@ -256,6 +265,7 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin): return self._done2() def _done2(self): + self.log("done2", level=log.NOISY) self._readers = [] self._done_observers.fire(None) -- 2.45.2