encode: delay completion until all our messages have been delivered
authorBrian Warner <warner@lothar.com>
Sun, 3 Dec 2006 07:53:38 +0000 (00:53 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 3 Dec 2006 07:53:38 +0000 (00:53 -0700)
allmydata/encode.py

index 946db1e04a4df258a041b685eb1ad0bc5a1444d4..a9b3d4759b7591dd9210ad72c8c514eac3ec1bc1 100644 (file)
@@ -7,9 +7,10 @@ class Encoder(object):
         self.m = m
 
     def do_upload(self, landlords):
+        dl = []
         data = self.infile.read()
         for (peerid, bucket_num, remotebucket) in landlords:
-            remotebucket.callRemote('write', data)
-            remotebucket.callRemote('finalise')
+            dl.append(remotebucket.callRemote('write', data))
+            dl.append(remotebucket.callRemote('close'))
 
-        return defer.succeed()
+        return defer.DeferredList(dl)