aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-10-12 20:22:07 +0200
committerKim Alvefur <zash@zash.se>2019-10-12 20:22:07 +0200
commitc5a70f10627bcdbc1b9f67e055574bbedc801fac (patch)
treeb7b45d44337ab371b022817b6fbbb63d57b816da /net/server_epoll.lua
parent066ee6e7810f638be65445ef7161ee41b6e33f14 (diff)
downloadprosody-c5a70f10627bcdbc1b9f67e055574bbedc801fac.tar.gz
prosody-c5a70f10627bcdbc1b9f67e055574bbedc801fac.zip
net.server_epoll: Save IP and port from connection creation call
Might come out of :getpeername different later but at least it's something.
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 9feba360..a2052875 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -775,6 +775,10 @@ local function addclient(addr, port, listeners, read_size, tls_ctx, typ, extra)
if not ok and err ~= "timeout" then return ok, err; end
local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx, extra)
local ok, err = client:init();
+ if not client.peername then
+ -- otherwise not set until connected
+ client.peername, client.peerport = addr, port;
+ end
if not ok then return ok, err; end
client:debug("Client %s created", client);
if tls_ctx then