]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Share: drop received data after each block finishes. Quick fix for the #1170 spans...
authorBrian Warner <warner@lothar.com>
Wed, 1 Sep 2010 01:35:58 +0000 (18:35 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 1 Sep 2010 01:35:58 +0000 (18:35 -0700)
src/allmydata/immutable/downloader/share.py
src/allmydata/test/test_immutable.py

index f7ed4e86866ddd725bfccf3e26df5b28dc65c8c0..413f90772f5f14a441b68aceac4bb1fca446fed3 100644 (file)
@@ -531,6 +531,9 @@ class Share:
             for o in observers:
                 # goes to SegmentFetcher._block_request_activity
                 o.notify(state=COMPLETE, block=block)
+            # now clear our received data, to dodge the #1170 spans.py
+            # complexity bug
+            self._received = DataSpans()
         except (BadHashError, NotEnoughHashesError), e:
             # rats, we have a corrupt block. Notify our clients that they
             # need to look elsewhere, and advise the server. Unlike
index 813c5befa0c4015e43ea0ec691da586897cf7dac..288332d08e928ed6108a005571a3d7a63c799cd9 100644 (file)
@@ -52,7 +52,7 @@ class Test(common.ShareManglingMixin, common.ShouldFailMixin, unittest.TestCase)
         def _after_download(unused=None):
             after_download_reads = self._count_reads()
             #print before_download_reads, after_download_reads
-            self.failIf(after_download_reads-before_download_reads > 27,
+            self.failIf(after_download_reads-before_download_reads > 36,
                         (after_download_reads, before_download_reads))
         d.addCallback(self._download_and_check_plaintext)
         d.addCallback(_after_download)
@@ -70,7 +70,7 @@ class Test(common.ShareManglingMixin, common.ShouldFailMixin, unittest.TestCase)
         def _after_download(unused=None):
             after_download_reads = self._count_reads()
             #print before_download_reads, after_download_reads
-            self.failIf(after_download_reads-before_download_reads > 27, (after_download_reads, before_download_reads))
+            self.failIf(after_download_reads-before_download_reads > 37, (after_download_reads, before_download_reads))
         d.addCallback(self._download_and_check_plaintext)
         d.addCallback(_after_download)
         return d