From 6d88b49540cf7d551fb6ef58650e4b86b3106640 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 22 Aug 2016 17:20:54 +0200 Subject: net.server_epoll: Tailcalls --- net/server_epoll.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 21a6f785..427f470a 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -479,17 +479,18 @@ function interface:init() 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 @@ function interface:pausefor(t) 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 -- cgit v1.2.3