Diff

net/server_epoll.lua @ 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
parent 8542:8c39ec8e6018
child 8555:4f0f5b49bb03
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);