diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-22 17:19:49 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-22 17:19:49 +0200 |
commit | f042a31e6c777161bb5ff4ec0c00c6684d4063b7 (patch) | |
tree | dfa1d4b553296fd8187ada7a414b39c6f7a5b0fa /net | |
parent | 0397de93491eccc30401f00020a15977a74496c9 (diff) | |
download | prosody-f042a31e6c777161bb5ff4ec0c00c6684d4063b7.tar.gz prosody-f042a31e6c777161bb5ff4ec0c00c6684d4063b7.zip |
net.server_epoll: Move management of fd registry to :setflags
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index c3b9974c..21a6f785 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -263,6 +263,11 @@ function interface:setflags(r, w) -- log("debug", "epoll_ctl(%q, %d, %q) -> %s" .. (err and ", %q" or ""), -- op, fd, flags or "", tostring(ok), err); if not ok then return ok, err end + if op == "add" then + fds[fd] = self; + elseif op == "del" then + fds[fd] = nil; + end self._flags = flags; return true; end @@ -367,7 +372,6 @@ function interface:destroy() self.destroy = noop; self.close = noop; self.on = noop; - fds[self:getfd()] = nil; self.conn:close(); self.conn = nil; end @@ -455,8 +459,6 @@ local function wrapsocket(client, server, pattern, listeners, tls) -- luasocket if client.getsockname then conn.sockname, conn.sockport = client:getsockname(); end - - fds[conn:getfd()] = conn; return conn; end @@ -528,7 +530,6 @@ local function addserver(addr, port, listeners, pattern, tls) sockport = port; }, interface_mt); server:setflags(true, false); - fds[server:getfd()] = server; return server; end |