do not cache and re-use imm filenodes in nodemaker 30/head
authorZooko O'Whielacronx <zooko@zooko.com>
Thu, 7 Feb 2013 16:35:43 +0000 (16:35 +0000)
committerZooko O'Whielacronx <zooko@zooko.com>
Thu, 7 Feb 2013 16:35:43 +0000 (16:35 +0000)
fixes #1679

src/allmydata/immutable/filenode.py
src/allmydata/nodemaker.py

index 7def22c824186ebb1706bcfa65ea021dbe268dfb..79e282d90e232a2645b56e7b14cf1a765fd463e3 100644 (file)
@@ -86,6 +86,8 @@ class CiphertextFileNode:
     def raise_error(self):
         pass
 
+    def is_mutable(self):
+        return False
 
     def check_and_repair(self, monitor, verify=False, add_lease=False):
         c = Checker(verifycap=self._verifycap,
index c820c71ca1732a8ced1d8397be55c6e5685c3b5d..d590bf5aea63a4fb0c3d817b07bd9486ccc01e30 100644 (file)
@@ -72,12 +72,12 @@ class NodeMaker:
             cap = uri.from_string(bigcap, deep_immutable=deep_immutable,
                                   name=name)
             node = self._create_from_single_cap(cap)
-            if node:
-                self._node_cache[memokey] = node  # note: WeakValueDictionary
-            else:
+            if node is None:
                 # don't cache UnknownNode
                 node = UnknownNode(writecap, readcap,
                                    deep_immutable=deep_immutable, name=name)
+            elif node.is_mutable():
+                self._node_cache[memokey] = node  # note: WeakValueDictionary
 
         if self.blacklist:
             si = node.get_storage_index()