diff options
author | Kim Alvefur <zash@zash.se> | 2019-09-29 15:00:28 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-09-29 15:00:28 +0200 |
commit | 2a4bd1629c9ff0bd2bfce459c09440386061f695 (patch) | |
tree | a5302b890a1e1b5073f6b62ebbbc1521cd354008 | |
parent | 5ee42bd47c64aab40311f06c9a70f6a689536655 (diff) | |
download | prosody-2a4bd1629c9ff0bd2bfce459c09440386061f695.tar.gz prosody-2a4bd1629c9ff0bd2bfce459c09440386061f695.zip |
net.server_epoll: Make log tag accessible as a field
To allow referencing connections by id instead of tostring form
-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 fd9e0416..633b038c 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -567,6 +567,7 @@ end 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 @@ local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra) 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); |