Comparison

net/server_epoll.lua @ 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
parent 10278:94c584d67533
child 10280:6b8b255f1d10
comparison
equal deleted inserted replaced
10278:94c584d67533 10279:0e1701197722
565 end 565 end
566 end 566 end
567 567
568 local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra) -- luasocket object -> interface object 568 local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra) -- luasocket object -> interface object
569 client:settimeout(0); 569 client:settimeout(0);
570 local conn_id = ("conn%s"):format(new_id());
570 local conn = setmetatable({ 571 local conn = setmetatable({
571 conn = client; 572 conn = client;
572 _server = server; 573 _server = server;
573 created = gettime(); 574 created = gettime();
574 listeners = listeners; 575 listeners = listeners;
575 read_size = read_size or (server and server.read_size); 576 read_size = read_size or (server and server.read_size);
576 writebuffer = {}; 577 writebuffer = {};
577 tls_ctx = tls_ctx or (server and server.tls_ctx); 578 tls_ctx = tls_ctx or (server and server.tls_ctx);
578 tls_direct = server and server.tls_direct; 579 tls_direct = server and server.tls_direct;
579 log = logger.init(("conn%s"):format(new_id())); 580 id = conn_id;
581 log = logger.init(conn_id);
580 extra = extra; 582 extra = extra;
581 }, interface_mt); 583 }, interface_mt);
582 584
583 if extra then 585 if extra then
584 if extra.servername then 586 if extra.servername then