aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commitd60907bc227f7434a7ca36ba93b09e4e30696187 (patch)
treef12018683c65ba1a24c4932b8fd4da4d393234ae /net
parentf14ac4df604a27a7e0cd3315cf57abcfb7424123 (diff)
downloadprosody-d60907bc227f7434a7ca36ba93b09e4e30696187.tar.gz
prosody-d60907bc227f7434a7ca36ba93b09e4e30696187.zip
net.server_epoll: Use first writable event to signal onconnect
Diffstat (limited to 'net')
-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);