immutable: tidy up the notification of waiters for ReadBucketProxy
authorZooko O'Whielacronx <zooko@zooko.com>
Mon, 5 Jan 2009 20:35:22 +0000 (13:35 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Mon, 5 Jan 2009 20:35:22 +0000 (13:35 -0700)
src/allmydata/immutable/layout.py

index d1c2da45c66ccf06978f4832a46ca6d39d8bb5b8..f64b388fe9fab095a7f708d3e6b22e87b1b31735 100644 (file)
@@ -289,7 +289,9 @@ class ReadBucketProxy:
         d.addCallback(self._parse_sharehashtree_and_ueb)
         def _fail_waiters(f):
             self._ready.fire(f)
-        d.addErrback(_fail_waiters)
+        def _notify_waiters(result):
+            self._ready.fire(result)
+        d.addCallbacks(_notify_waiters, _fail_waiters)
         return d
 
     def _fetch_header(self):
@@ -351,8 +353,6 @@ class ReadBucketProxy:
         length = struct.unpack(self._fieldstruct, data[i:i+self._fieldsize])[0]
         self._ueb_data = data[i+self._fieldsize:i+self._fieldsize+length]
 
-        self._ready.fire(self)
-
     def _get_block_data(self, unused, blocknum, blocksize, thisblocksize):
         offset = self._offsets['data'] + blocknum * blocksize
         return self._read(offset, thisblocksize)