Changeset

7559:b1b27dedf4cf

net.server_epoll: Replace any previous pausefor timer
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2016 01:11:59 +0200
parents 7558:3a2fe8e10eeb
children 7560:785fa1138293
files net/server_epoll.lua
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Fri Aug 12 00:25:19 2016 +0200
+++ b/net/server_epoll.lua	Fri Aug 12 01:11:59 2016 +0200
@@ -412,10 +412,15 @@
 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()