Changeset

10279:0e1701197722

net.server_epoll: Make log tag accessible as a field To allow referencing connections by id instead of tostring form
author Kim Alvefur <zash@zash.se>
date Sun, 29 Sep 2019 15:00:28 +0200 (2019-09-29)
parents 10278:94c584d67533
children 10280:6b8b255f1d10
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sun Sep 29 14:50:04 2019 +0200
+++ b/net/server_epoll.lua	Sun Sep 29 15:00:28 2019 +0200
@@ -567,6 +567,7 @@
 
 local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra) -- luasocket object -> interface object
 	client:settimeout(0);
+	local conn_id = ("conn%s"):format(new_id());
 	local conn = setmetatable({
 		conn = client;
 		_server = server;
@@ -576,7 +577,8 @@
 		writebuffer = {};
 		tls_ctx = tls_ctx or (server and server.tls_ctx);
 		tls_direct = server and server.tls_direct;
-		log = logger.init(("conn%s"):format(new_id()));
+		id = conn_id;
+		log = logger.init(conn_id);
 		extra = extra;
 	}, interface_mt);