From 7e47a9ca354d57919ceb04c1073d89b419f5e178 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 28 Mar 2019 12:31:14 +0100 Subject: net.server_epoll: Handle LuaSec wantread/wantwrite conditions before callbacks (fixes #1333) This prevents the :set(true) call from resuming a connection that was paused in the onincoming callback. --- net/server_epoll.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 5c65d227..cffd3a84 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -355,15 +355,18 @@ function interface:onreadable() self:onconnect(); self:on("incoming", data); else - if partial and partial ~= "" then - self:onconnect(); - self:on("incoming", partial, err); - end if err == "wantread" then self:set(true, nil); + err = "timeout"; elseif err == "wantwrite" then self:set(nil, true); - elseif err ~= "timeout" then + err = "timeout"; + end + if partial and partial ~= "" then + self:onconnect(); + self:on("incoming", partial, err); + end + if err ~= "timeout" then self:on("disconnect", err); self:destroy() return; -- cgit v1.2.3