diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-28 12:31:14 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-28 12:31:14 +0100 |
commit | 2e154c965c798c38f6fd8daefb1b613d03a8f8f6 (patch) | |
tree | 47d10effeee2971b76bd2e9004e6ebf659ac79bd /net | |
parent | d0075a2784804a4197887c7f18200b6e83d0ee51 (diff) | |
download | prosody-2e154c965c798c38f6fd8daefb1b613d03a8f8f6.tar.gz prosody-2e154c965c798c38f6fd8daefb1b613d03a8f8f6.zip |
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.
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 13 |
1 files changed, 8 insertions, 5 deletions
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; |