Diff

net/server_epoll.lua @ 10332:e05ea8223b32

net.server_epoll: Save IP and port from connection creation call Might come out of :getpeername different later but at least it's something.
author Kim Alvefur <zash@zash.se>
date Sat, 12 Oct 2019 20:22:07 +0200
parent 10331:76bd77ad6a2a
child 10416:6af8c812a885
line wrap: on
line diff
--- a/net/server_epoll.lua	Sat Oct 12 20:15:31 2019 +0200
+++ b/net/server_epoll.lua	Sat Oct 12 20:22:07 2019 +0200
@@ -775,6 +775,10 @@
 	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