From 8ac98af8b88e3f2d7f8d91a5dfe568cc2b9b86d2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 19 Nov 2021 15:45:01 +0100 Subject: net.server_epoll: Fix streaming downloads (thanks Menel) ff4e34c448a4 broke the way net.http.server streams downloads from disk because it made writes from the ondrain callback no longer reset the want-write flag, causing the download to halt. Writes from the predrain handler still must not trigger anything but additions to the buffer, since it is about to do all the socket writing already. --- net/server_epoll.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 8a70e2dc..4852d7c0 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -513,9 +513,9 @@ function interface:onwritable() else self.writebuffer = nil; end + self._writing = nil; self:setwritetimeout(false); self:ondrain(); -- Be aware of writes in ondrain - self._writing = nil; return ok; elseif partial then self:debug("Sent %d out of %d buffered bytes", partial, #data); -- cgit v1.2.3