Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10420:49a828819696
net.server_epoll: Save log tag in a field on FD watchers too
As with 0e1701197722
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 17 Nov 2019 23:47:31 +0100 |
parent | 10419:3b9d17c234df |
child | 10486:479e96e554c8 |
comparison
equal
deleted
inserted
replaced
10419:3b9d17c234df | 10420:49a828819696 |
---|---|
800 conn.getfd = function () | 800 conn.getfd = function () |
801 return fd; | 801 return fd; |
802 end; | 802 end; |
803 -- Otherwise it'll need to be something LuaSocket-compatible | 803 -- Otherwise it'll need to be something LuaSocket-compatible |
804 end | 804 end |
805 conn.log = logger.init(("fdwatch%s"):format(new_id())); | 805 conn.id = new_id(); |
806 conn.log = logger.init(("fdwatch%s"):format(conn.id)); | |
806 conn:add(onreadable, onwritable); | 807 conn:add(onreadable, onwritable); |
807 return conn; | 808 return conn; |
808 end; | 809 end; |
809 | 810 |
810 -- Dump all data from one connection into another | 811 -- Dump all data from one connection into another |
909 close = function (self) | 910 close = function (self) |
910 self:del(); | 911 self:del(); |
911 fds[fd] = nil; | 912 fds[fd] = nil; |
912 end; | 913 end; |
913 }, interface_mt); | 914 }, interface_mt); |
914 conn.log = logger.init(("fdwatch%d"):format(conn:getfd())); | 915 conn.id = conn:getfd(); |
916 conn.log = logger.init(("fdwatch%d"):format(conn.id)); | |
915 local ok, err = conn:add(mode == "r" or mode == "rw", mode == "w" or mode == "rw"); | 917 local ok, err = conn:add(mode == "r" or mode == "rw", mode == "w" or mode == "rw"); |
916 if not ok then return ok, err; end | 918 if not ok then return ok, err; end |
917 return conn; | 919 return conn; |
918 end; | 920 end; |
919 }; | 921 }; |