Changeset

7626:e56343d50293

net.server_epoll: Tailcalls
author Kim Alvefur <zash@zash.se>
date Mon, 22 Aug 2016 17:20:54 +0200 (2016-08-22)
parents 7625:6afafd6d4ef0
children 7627:d8126298c729
files net/server_epoll.lua
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Mon Aug 22 17:19:49 2016 +0200
+++ b/net/server_epoll.lua	Mon Aug 22 17:20:54 2016 +0200
@@ -479,17 +479,18 @@
 		self._tls = false; -- This means we should call onconnect when TLS is up
 		return self:starttls();
 	else
-		self:setflags(false, true);
-		self:setwritetimeout(cfg.connect_timeout);
+		self.onwriteable = interface.onconnect;
+		self:setwritetimeout();
+		return self:setflags(false, true);
 	end
 end
 
 function interface:pause()
-	self:setflags(false);
+	return self:setflags(false);
 end
 
 function interface:resume()
-	self:setflags(true);
+	return self:setflags(true);
 end
 
 -- Pause connection for some time
@@ -501,10 +502,10 @@
 	self:setflags(false);
 	self._pausefor = addtimer(t, function ()
 		self._pausefor = nil;
-		self:setflags(true);
 		if self.conn:dirty() then
 			self:onreadable();
 		end
+		return self:setflags(true);
 	end);
 end