aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-10 20:59:54 +0200
committerKim Alvefur <zash@zash.se>2016-08-10 20:59:54 +0200
commit1c985cf5512adf2b49f6c9cc8eea1a90982504a7 (patch)
treef12018683c65ba1a24c4932b8fd4da4d393234ae /net/server_epoll.lua
parent1c2694ccf7e515e481f054743587cf430f24a02f (diff)
downloadprosody-1c985cf5512adf2b49f6c9cc8eea1a90982504a7.tar.gz
prosody-1c985cf5512adf2b49f6c9cc8eea1a90982504a7.zip
net.server_epoll: Use first writable event to signal onconnect
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index c1bcbc39..5b61bd26 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -374,6 +374,7 @@ local function wrapsocket(client, server, pattern, listeners, tls) -- luasocket
created = gettime();
listeners = listeners;
_pattern = pattern or server._pattern;
+ onwriteable = interface.onconnect;
writebuffer = {};
tls = tls;
}, interface_mt);
@@ -397,8 +398,7 @@ function interface:onacceptable()
client._tls = false;
client:starttls();
else
- self.listeners.onconnect(client);
- client:setflags(true);
+ client:setflags(false, true);
end
client:setreadtimeout();
end
@@ -419,9 +419,10 @@ function interface:pausefor(t)
end
function interface:onconnect()
- self.onreadable = nil;
self.onwriteable = nil;
self.listeners.onconnect(self);
+ self:setflags(true);
+ return self:onwriteable();
end
local function addserver(addr, port, listeners, pattern, tls)
@@ -451,7 +452,6 @@ local function wrapclient(conn, addr, port, listeners, pattern, tls)
_pattern = pattern;
writebuffer = {};
tls = tls;
- onreadable = interface.onconnect;
onwriteable = interface.onconnect;
peer = { addr, port };
}, interface_mt);