]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
mutable/publish: use unpack_mdmf_checkstring and unpack_sdmf_checkstring instead...
authorkevan <kevan@isnotajoke.com>
Sat, 24 Sep 2011 23:51:37 +0000 (16:51 -0700)
committerkevan <kevan@isnotajoke.com>
Sat, 24 Sep 2011 23:51:37 +0000 (16:51 -0700)
src/allmydata/mutable/publish.py

index 0eceedb10cc01188ebd0c52147855d8e4c667ef3..edd30e48236be8bc92620127ecacd54be3a9fa13 100644 (file)
@@ -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: