Changeset

7384:65abd9d7bf88

net.server_event: Re-add write event if writebuffer is non-empty after write (eg due to writes from ondrain callback) (fixes #661)
author Kim Alvefur <zash@zash.se>
date Tue, 19 Apr 2016 17:24:00 +0200
parents 7383:69827ee1f951
children 7385:17929cdacec2 7392:c774622ad9db
files net/server_event.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_event.lua	Tue Apr 19 17:20:39 2016 +0200
+++ b/net/server_event.lua	Tue Apr 19 17:24:00 2016 +0200
@@ -548,6 +548,10 @@
 					elseif interface.eventreadtimeout then
 						return EV_WRITE, EV_TIMEOUT
 					end
+					if interface.writebuffer ~= 0 then
+						-- data possibly written from ondrain
+						return EV_WRITE, cfg.WRITE_TIMEOUT
+					end
 					interface.eventwrite = nil
 					return -1
 				elseif byte and (err == "timeout" or err == "wantwrite") then  -- want write again