# HG changeset patch # User Kim Alvefur # Date 1519666287 -3600 # Node ID 1fcefc16a55d254d6effdfd9bb165e46c097f947 # Parent 2bd2e94a04965a5cf739db86548c27cb5485bb2e server_epoll: Onconnect should happen before first attempt to write to socket diff -r 2bd2e94a0496 -r 1fcefc16a55d net/server_epoll.lua --- a/net/server_epoll.lua Mon Feb 26 15:27:00 2018 +0000 +++ b/net/server_epoll.lua Mon Feb 26 18:31:27 2018 +0100 @@ -334,6 +334,7 @@ -- Called when socket is writable function interface:onwritable() + self:onconnect(); local buffer = self.writebuffer; local data = t_concat(buffer); local ok, err, partial = self.conn:send(data); @@ -344,7 +345,6 @@ end self:setwritetimeout(false); self:ondrain(); -- Be aware of writes in ondrain - self:onconnect(); return; elseif partial then buffer[1] = data:sub(partial+1);