Diff

net/server_event.lua @ 7392:c774622ad9db

net.server_event: Fix traceback if event re-added during starttls
author Kim Alvefur <zash@zash.se>
date Tue, 19 Apr 2016 18:18:57 +0200
parent 7384:65abd9d7bf88
child 7393:1909bde0e79f
line wrap: on
line diff
--- a/net/server_event.lua	Tue Apr 19 17:24:00 2016 +0200
+++ b/net/server_event.lua	Tue Apr 19 18:18:57 2016 +0200
@@ -545,13 +545,12 @@
 					elseif interface.startsslcallback then  -- start ssl connection if needed
 						debug "starting ssl handshake after writing"
 						interface.eventstarthandshake = addevent( base, nil, EV_TIMEOUT, interface.startsslcallback, 0 )
+					elseif interface.writebuffer ~= 0 then
+						-- data possibly written from ondrain
+						return EV_WRITE, cfg.WRITE_TIMEOUT
 					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