# HG changeset patch # User Kim Alvefur # Date 1626389805 -7200 # Node ID 6efbcd52db210956d1de3636f3e9044a3e31d3d8 # Parent b7f07585ec4cd161870129f06c63bdc0ed0245ee net.server_epoll: Move call to refresh remote IP address out of wrapper Reduces the side effects of wrapsocket() diff -r b7f07585ec4c -r 6efbcd52db21 net/server_epoll.lua --- 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