]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable/checker.py: trap ShareVersionIncompatible too. Also, use f.check
authorBrian Warner <warner@lothar.com>
Tue, 24 Feb 2009 05:14:05 +0000 (22:14 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 24 Feb 2009 05:14:05 +0000 (22:14 -0700)
instead of examining the value returned by f.trap, because the latter appears
to squash exception types down into their base classes (i.e. since
ShareVersionIncompatible is a subclass of LayoutInvalid,
f.trap(Failure(ShareVersionIncompatible)) == LayoutInvalid).

All this resulted in 'incompatible' shares being misclassified as 'corrupt'.

src/allmydata/immutable/checker.py

index 22297be62e4f2df7195cd6760cac8a4ed22b22e8..74343639211875698eaa5e03ef391503ab18ccce 100644 (file)
@@ -141,14 +141,15 @@ class Checker(log.PrefixingLogMixin):
                               rrefutil.ServerFailure,
                               layout.LayoutInvalid,
                               layout.RidiculouslyLargeURIExtensionBlock,
+                              layout.ShareVersionIncompatible,
                               download.BadOrMissingHash,
                               download.BadURIExtensionHashValue)
 
-            if failtype is DeadReferenceError:
+            if f.check(DeadReferenceError):
                 return (False, sharenum, 'disconnect')
-            elif failtype is rrefutil.ServerFailure:
+            elif f.check(rrefutil.ServerFailure):
                 return (False, sharenum, 'failure')
-            elif failtype is layout.ShareVersionIncompatible:
+            elif f.check(layout.ShareVersionIncompatible):
                 return (False, sharenum, 'incompatible')
             else:
                 return (False, sharenum, 'corrupt')