Changeset

8552:1fcefc16a55d

server_epoll: Onconnect should happen before first attempt to write to socket
author Kim Alvefur <zash@zash.se>
date Mon, 26 Feb 2018 18:31:27 +0100
parents 8551:2bd2e94a0496
children 8553:32438665dc5e
files net/server_epoll.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);