]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
offloaded.py: don't drop the Deferred
authorBrian Warner <warner@lothar.com>
Tue, 12 Jun 2012 01:16:02 +0000 (18:16 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 12 Jun 2012 01:16:02 +0000 (18:16 -0700)
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

index 20a4fd7cbd3de2c2d188c315b62f8f6a77721907..5365bad4adee5b6340de8bfc6ee48b2e9a859239 100644 (file)
@@ -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)