Changeset

11922:28f5c8061dad

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.
author Kim Alvefur <zash@zash.se>
date Fri, 19 Nov 2021 15:45:01 +0100
parents 11921:89aef37fca54
children 11923:bd0440c12842
files net/server_epoll.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Thu Nov 18 16:26:54 2021 +0100
+++ b/net/server_epoll.lua	Fri Nov 19 15:45:01 2021 +0100
@@ -513,9 +513,9 @@
 		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);