From: kevan Date: Sat, 24 Sep 2011 23:51:37 +0000 (-0700) Subject: mutable/publish: use unpack_mdmf_checkstring and unpack_sdmf_checkstring instead... X-Git-Tag: allmydata-tahoe-1.9.0a2~10 X-Git-Url: https://git.rkrishnan.org/simplejson/components/COPYING.TGPPL.html?a=commitdiff_plain;h=a911e15783e6fca7eabc926b93b0c2a9eb0c8feb;p=tahoe-lafs%2Ftahoe-lafs.git mutable/publish: use unpack_mdmf_checkstring and unpack_sdmf_checkstring instead of unpack_checkstring. fixes #1540 --- diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py index 0eceedb1..edd30e48 100644 --- a/src/allmydata/mutable/publish.py +++ b/src/allmydata/mutable/publish.py @@ -18,8 +18,11 @@ from foolscap.api import eventually, fireEventually from allmydata.mutable.common import MODE_WRITE, MODE_CHECK, \ UncoordinatedWriteError, NotEnoughServersError from allmydata.mutable.servermap import ServerMap -from allmydata.mutable.layout import unpack_checkstring, MDMFSlotWriteProxy, \ - SDMFSlotWriteProxy +from allmydata.mutable.layout import get_version_from_checkstring,\ + unpack_mdmf_checkstring, \ + unpack_sdmf_checkstring, \ + MDMFSlotWriteProxy, \ + SDMFSlotWriteProxy, MDMFCHECKSTRING KiB = 1024 DEFAULT_MAX_SEGMENT_SIZE = 128 * KiB @@ -1101,9 +1104,14 @@ class Publish: # use the checkstring to add information to the log message for (shnum,readv) in read_data.items(): checkstring = readv[0] - (other_seqnum, - other_roothash, - other_salt) = unpack_checkstring(checkstring) + version = get_version_from_checkstring(checkstring) + if version == MDMF_VERSION: + (other_seqnum, + other_roothash) = unpack_mdmf_checkstring(checkstring) + else: + (other_seqnum, + other_roothash, + other_salt) = unpack_sdmf_checkstring(checkstring) expected_version = self._servermap.version_on_peer(peerid, shnum) if expected_version: