net.server_epoll: Save log tag in a field on FD watchers too
authorKim Alvefur <zash@zash.se>
Sun, 17 Nov 2019 23:27:48 +0100
changeset 10422 c8aa66595072
parent 10421 d8a0b0d21c81
child 10423 3b9d17c234df
net.server_epoll: Save log tag in a field on FD watchers too As with 0e1701197722
net/server_epoll.lua
--- a/net/server_epoll.lua	Sat Oct 19 20:11:21 2019 +0200
+++ b/net/server_epoll.lua	Sun Nov 17 23:27:48 2019 +0100
@@ -383,7 +383,7 @@
 		end
 		if err ~= "timeout" then
 			self:on("disconnect", err);
-			self:destroy()
+			self:close()
 			return;
 		end
 	end
@@ -802,7 +802,8 @@
 		end;
 		-- Otherwise it'll need to be something LuaSocket-compatible
 	end
-	conn.log = logger.init(("fdwatch%s"):format(new_id()));
+	conn.id = new_id();
+	conn.log = logger.init(("fdwatch%s"):format(conn.id));
 	conn:add(onreadable, onwritable);
 	return conn;
 end;
@@ -911,7 +912,8 @@
 				fds[fd] = nil;
 			end;
 		}, interface_mt);
-		conn.log = logger.init(("fdwatch%d"):format(conn:getfd()));
+		conn.id = conn:getfd();
+		conn.log = logger.init(("fdwatch%d"):format(conn.id));
 		local ok, err = conn:add(mode == "r" or mode == "rw", mode == "w" or mode == "rw");
 		if not ok then return ok, err; end
 		return conn;