]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
download.py: make logging safe in ValidatedBucket
authorBrian Warner <warner@allmydata.com>
Wed, 6 Feb 2008 09:50:34 +0000 (02:50 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 6 Feb 2008 09:50:34 +0000 (02:50 -0700)
src/allmydata/download.py

index 592ae42f32d267b3255aca29940e5a617afe2a95..a8c6a3e91b84a1e2cc72354b089a2d6f537e6682 100644 (file)
@@ -159,6 +159,7 @@ class ValidatedBucket:
 
     def _got_data(self, res, blocknum):
         sharehashes, blockhashes, blockdata = res
+        blockhash = None # to make logging it safe
 
         try:
             if not self._share_hash:
@@ -197,7 +198,7 @@ class ValidatedBucket:
                 received from the remote peer were bad.""")
             log.msg(" have self._share_hash: %s" % bool(self._share_hash))
             log.msg(" block length: %d" % len(blockdata))
-            log.msg(" block hash: %s" % idlib.b2a_or_none(blockhash)) # not safe
+            log.msg(" block hash: %s" % idlib.b2a_or_none(blockhash))
             if len(blockdata) < 100:
                 log.msg(" block data: %r" % (blockdata,))
             else: