From: Brian Warner Date: Thu, 13 Oct 2011 20:12:19 +0000 (-0700) Subject: web/filenode.py: rely on Request.notifyFinish. Closes #1366. X-Git-Tag: allmydata-tahoe-1.9.0b1~4 X-Git-Url: https://git.rkrishnan.org/module-simplejson.decoder.html?a=commitdiff_plain;h=3eb60ff986563e79c72b701a4a0cb6f16229089f;p=tahoe-lafs%2Ftahoe-lafs.git web/filenode.py: rely on Request.notifyFinish. Closes #1366. This is safe now that tahoe depends upon Twisted>=10.1, since notifyFinish first appeared in Twisted-9.0 --- diff --git a/src/allmydata/web/filenode.py b/src/allmydata/web/filenode.py index 3e4abf13..18ffe2df 100644 --- a/src/allmydata/web/filenode.py +++ b/src/allmydata/web/filenode.py @@ -452,13 +452,10 @@ class FileDownloader(rend.Page): if req.method == "HEAD": return "" - # Twisted >=9.0 throws an error if we call req.finish() on a closed - # HTTP connection. It also has req.notifyFinish() to help avoid it. finished = [] def _request_finished(ign): finished.append(True) - if hasattr(req, "notifyFinish"): - req.notifyFinish().addBoth(_request_finished) + req.notifyFinish().addBoth(_request_finished) d = self.filenode.read(req, first, size)