diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-16 00:56:45 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-16 00:56:45 +0200 |
commit | 269acd68472dac66fd0ce7e4e76cbc725f534b9c (patch) | |
tree | fecf143d797895b8eb9ece0ecd2e66cee572b691 | |
parent | 575b997d1dd13d4295e5bc2f612f8f639c5d9a60 (diff) | |
download | prosody-269acd68472dac66fd0ce7e4e76cbc725f534b9c.tar.gz prosody-269acd68472dac66fd0ce7e4e76cbc725f534b9c.zip |
net.server_epoll: Move call to refresh remote IP address out of wrapper
Reduces the side effects of wrapsocket()
-rw-r--r-- | net/server_epoll.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 07fb6dd9..d6b09de3 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -765,7 +765,6 @@ local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra) end end - conn:updatenames(); return conn; end @@ -791,6 +790,7 @@ function interface:onacceptable() 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 @@ end -- 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 function addclient(addr, port, listeners, read_size, tls_ctx, typ, extra) 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 |