upload: when using a Helper, insist that it provide protocols/helper/v1 . Related...
authorBrian Warner <warner@allmydata.com>
Sat, 22 Nov 2008 03:29:32 +0000 (20:29 -0700)
committerBrian Warner <warner@allmydata.com>
Sat, 22 Nov 2008 03:29:32 +0000 (20:29 -0700)
src/allmydata/immutable/upload.py

index 3b653d8a3734062c786d52833f8a2555c272f05c..c37aa0e9f597724059b600737b5a11524db27987 100644 (file)
@@ -18,7 +18,8 @@ from allmydata.util import base32, idlib, mathutil
 from allmydata.util.assertutil import precondition
 from allmydata.util.rrefutil import get_versioned_remote_reference
 from allmydata.interfaces import IUploadable, IUploader, IUploadResults, \
-     IEncryptedUploadable, RIEncryptedUploadable, IUploadStatus, NotEnoughSharesError
+     IEncryptedUploadable, RIEncryptedUploadable, IUploadStatus, \
+     NotEnoughSharesError, InsufficientVersionError
 from allmydata.immutable import layout
 from pycryptopp.cipher.aes import AES
 
@@ -1242,6 +1243,9 @@ class Uploader(service.MultiService):
         d.addCallback(self._got_versioned_helper)
 
     def _got_versioned_helper(self, helper):
+        needed = "http://allmydata.org/tahoe/protocols/helper/v1"
+        if needed not in helper.version:
+            raise InsufficientVersionError(needed, helper.version)
         self._helper = helper
         helper.notifyOnDisconnect(self._lost_helper)