mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 06:17:50 +00:00
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
This commit is contained in:
parent
587e31a8cf
commit
3eb60ff986
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user