MutableFileNode.set_downloader_hints: never depend upon order of dict.values()
authorBrian Warner <warner@lothar.com>
Sun, 28 Aug 2011 07:41:03 +0000 (00:41 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 28 Aug 2011 07:41:03 +0000 (00:41 -0700)
The old code was calculating the "extension parameters" (a list) from the
downloader hints (a dictionary) with hints.values(), which is not stable, and
would result in corrupted filecaps (with the 'k' and 'segsize' hints
occasionally swapped). The new code always uses [k,segsize].

src/allmydata/mutable/filenode.py

index 59438b872339a8f6c3a784a4f2a72ce12b703212..02f99b645cc6125080399d8f80106e440e2ffb62 100644 (file)
@@ -701,7 +701,7 @@ class MutableFileNode:
 
     def set_downloader_hints(self, hints):
         self._downloader_hints = hints
-        extensions = hints.values()
+        extensions = [ hints["k"], hints["segsize"] ]
         self._uri.set_extension_params(extensions)