From cd4065264283a20c1ec1b90443724a5e743604ac Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Aug 2016 01:11:59 +0200 Subject: net.server_epoll: Replace any previous pausefor timer --- net/server_epoll.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index c6778e2b..66d9841c 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -412,10 +412,15 @@ function interface:resume() end function interface:pausefor(t) - if self._wantread then - self:setflags(false); - addtimer(t, function () self:setflags(true); end); + if self._pausefor then + self._pausefor:close(); end + if t == false then return; end + self:setflags(false); + self._pausefor = addtimer(t, function () + self._pausefor = nil; + self:setflags(true); + end); end function interface:onconnect() -- cgit v1.2.3