From: Brian Warner Date: Sun, 28 Aug 2011 07:41:03 +0000 (-0700) Subject: MutableFileNode.set_downloader_hints: never depend upon order of dict.values() X-Git-Tag: allmydata-tahoe-1.9.0a2~75 X-Git-Url: https://git.rkrishnan.org/simplejson/%22news.html/somewhere?a=commitdiff_plain;h=0f1d674d76490f71c02116bcfdc0620cd758c975;p=tahoe-lafs%2Ftahoe-lafs.git MutableFileNode.set_downloader_hints: never depend upon order of dict.values() 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]. --- diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index 59438b87..02f99b64 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -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)