From: Brian Warner Date: Wed, 1 Sep 2010 01:35:58 +0000 (-0700) Subject: Share: drop received data after each block finishes. Quick fix for the #1170 spans... X-Git-Tag: allmydata-tahoe-1.8.0c3~6 X-Git-Url: https://git.rkrishnan.org/components/provisioning?a=commitdiff_plain;h=c89a464510394089672d4f937c9707d5ca5e5ca9;p=tahoe-lafs%2Ftahoe-lafs.git Share: drop received data after each block finishes. Quick fix for the #1170 spans.py complexity bug. --- diff --git a/src/allmydata/immutable/downloader/share.py b/src/allmydata/immutable/downloader/share.py index f7ed4e86..413f9077 100644 --- a/src/allmydata/immutable/downloader/share.py +++ b/src/allmydata/immutable/downloader/share.py @@ -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 diff --git a/src/allmydata/test/test_immutable.py b/src/allmydata/test/test_immutable.py index 813c5bef..288332d0 100644 --- a/src/allmydata/test/test_immutable.py +++ b/src/allmydata/test/test_immutable.py @@ -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