Changeset

12513:6efbcd52db21

net.server_epoll: Move call to refresh remote IP address out of wrapper Reduces the side effects of wrapsocket()
author Kim Alvefur <zash@zash.se>
date Fri, 16 Jul 2021 00:56:45 +0200
parents 12512:b7f07585ec4c
children 12514:194469fb46f9
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Thu Jul 08 12:29:50 2021 +0200
+++ b/net/server_epoll.lua	Fri Jul 16 00:56:45 2021 +0200
@@ -765,7 +765,6 @@
 		end
 	end
 
-	conn:updatenames();
 	return conn;
 end
 
@@ -791,6 +790,7 @@
 		return;
 	end
 	local client = wrapsocket(conn, self, nil, self.listeners);
+	client:updatenames();
 	client:debug("New connection %s on server %s", client, self);
 	client:defaultoptions();
 	client._writable = cfg.opportunistic_writes;
@@ -935,6 +935,7 @@
 -- COMPAT
 local function wrapclient(conn, addr, port, listeners, read_size, tls_ctx, extra)
 	local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx, extra);
+	client:updatenames();
 	if not client.peername then
 		client.peername, client.peerport = addr, port;
 	end
@@ -974,6 +975,7 @@
 	local ok, err = conn:setpeername(addr, port);
 	if not ok and err ~= "timeout" then return ok, err; end
 	local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx, extra)
+	client:updatenames();
 	local ok, err = client:init();
 	if not client.peername then
 		-- otherwise not set until connected