From a809e4cababc385bf2807c973c7b66214326a7ae Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 11 Jun 2012 18:16:02 -0700 Subject: [PATCH] offloaded.py: don't drop the Deferred There was one corner case (where the client disconnects at just the wrong time) that could have dropped a Deferred, leading to an Unhandled Error. Clean up the control flow to avoid this case. --- src/allmydata/immutable/offloaded.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/allmydata/immutable/offloaded.py b/src/allmydata/immutable/offloaded.py index 20a4fd7c..5365bad4 100644 --- a/src/allmydata/immutable/offloaded.py +++ b/src/allmydata/immutable/offloaded.py @@ -325,14 +325,12 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin): # else. have = os.stat(self._encoding_file)[stat.ST_SIZE] d = self.call("read_encrypted", have-1, 1) - d.addCallback(self._done2, started) - return - - # first, find out how large the file is going to be - d = self.call("get_size") - d.addCallback(self._got_size) - d.addCallback(self._start_reading) - d.addCallback(self._done) + else: + # first, find out how large the file is going to be + d = self.call("get_size") + d.addCallback(self._got_size) + d.addCallback(self._start_reading) + d.addCallback(self._done) d.addCallback(self._done2, started) d.addErrback(self._failed) -- 2.45.2