]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
offloaded: close the local filehandle after encoding is done, otherwise windows fails
authorBrian Warner <warner@lothar.com>
Thu, 17 Jan 2008 08:52:33 +0000 (01:52 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 17 Jan 2008 08:52:33 +0000 (01:52 -0700)
src/allmydata/encode.py
src/allmydata/interfaces.py
src/allmydata/offloaded.py
src/allmydata/upload.py

index 06c8e1668d559254fa75f9e3205f779b23bd19b3..0d63a6fc489e542e1a83b1a888bbd158f3bcfdd7 100644 (file)
@@ -448,12 +448,10 @@ class Encoder(object):
     def finish_hashing(self):
         crypttext_hash = self._crypttext_hasher.digest()
         self.uri_extension_data["crypttext_hash"] = crypttext_hash
-        u = self._uploadable
-        d = u.get_plaintext_hash()
+        d = self._uploadable.get_plaintext_hash()
         def _got(plaintext_hash):
             self.uri_extension_data["plaintext_hash"] = plaintext_hash
-            return u.get_plaintext_hashtree_leaves(0, self.num_segments,
-                                                   self.num_segments)
+            return self._uploadable.get_plaintext_hashtree_leaves(0, self.num_segments, self.num_segments)
         d.addCallback(_got)
         def _got_hashtree_leaves(leaves):
             self.log("Encoder: got plaintext_hashtree_leaves: %s" %
@@ -462,6 +460,8 @@ class Encoder(object):
             self.uri_extension_data["plaintext_root_hash"] = ht[0]
             self._plaintext_hashtree_nodes = ht
         d.addCallback(_got_hashtree_leaves)
+
+        d.addCallback(lambda res: self._uploadable.close())
         return d
 
     def send_plaintext_hash_tree_to_all_shareholders(self):
index c748a8f0ae1bb55a12591f04d42111eb13926271..0bbd86c1a9a6c4785384c4f841e36cdda1daebc3 100644 (file)
@@ -1282,6 +1282,9 @@ class RIEncryptedUploadable(RemoteInterface):
     def get_plaintext_hash():
         return Hash
 
+    def close():
+        return None
+
 
 class RICHKUploadHelper(RemoteInterface):
     __remote_name__ = "RIUploadHelper.tahoe.allmydata.com"
index d1f62ef94c5074ecc69f7ba8b682036f61badc14..9f1966c16c454391e26d3ff5e0f650b328419d40 100644 (file)
@@ -295,7 +295,8 @@ class LocalCiphertextReader(AskUntilSuccessMixin):
     def get_plaintext_hash(self):
         return self.call("get_plaintext_hash")
     def close(self):
-        # ??
+        self.f.close()
+        # ??. I'm not sure if it makes sense to forward the close message.
         return self.call("close")
 
 
index 107d4c643698ddfdd67922f7e588766d86294e5c..04880a8afbd5ab3fc7c1827c25b0eab2ae6dc547 100644 (file)
@@ -498,6 +498,9 @@ class EncryptAnUploadable:
         h = self._plaintext_hasher.digest()
         return defer.succeed(h)
 
+    def close(self):
+        return self.original.close()
+
 
 class CHKUploader:
     peer_selector_class = Tahoe2PeerSelector
@@ -687,6 +690,8 @@ class RemoteEncryptedUploadable(Referenceable):
         return d
     def remote_get_plaintext_hash(self):
         return self._eu.get_plaintext_hash()
+    def remote_close(self):
+        return self._eu.close()
 
 
 class AssistedUploader: