diff options
-rw-r--r-- | net/server_epoll.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 4037f7ab..be0a5b6a 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -340,22 +340,25 @@ 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; end end if not self.conn then return; end - if self.conn:dirty() then + if self._wantread and self.conn:dirty() then self:setreadtimeout(false); self:pausefor(cfg.read_retry_delay); else |