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.
This commit is contained in:
Brian Warner 2012-06-11 18:16:02 -07:00
parent b82cddef7b
commit a809e4caba
1 changed files with 6 additions and 8 deletions

View File

@ -325,14 +325,12 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
# else. # else.
have = os.stat(self._encoding_file)[stat.ST_SIZE] have = os.stat(self._encoding_file)[stat.ST_SIZE]
d = self.call("read_encrypted", have-1, 1) d = self.call("read_encrypted", have-1, 1)
d.addCallback(self._done2, started) else:
return # first, find out how large the file is going to be
d = self.call("get_size")
# first, find out how large the file is going to be d.addCallback(self._got_size)
d = self.call("get_size") d.addCallback(self._start_reading)
d.addCallback(self._got_size) d.addCallback(self._done)
d.addCallback(self._start_reading)
d.addCallback(self._done)
d.addCallback(self._done2, started) d.addCallback(self._done2, started)
d.addErrback(self._failed) d.addErrback(self._failed)