# HG changeset patch # User Kim Alvefur # Date 1569764461 -7200 # Node ID cd669975031b2f580fef95e8c824eecc4220ce10 # Parent dff360d00dfa37240a80a15e9ad5c74ca9d7a7ea net.server_epoll: Fix link function to not replace listeners mod_proxy65 calls link twice, once for each direction. This would overwrite the listeners with one that has the previous listeners as metatable.__index, but none of the others. This takes advantage of 94c584d67533 to improve this. diff -r dff360d00dfa -r cd669975031b net/server_epoll.lua --- a/net/server_epoll.lua Sun Sep 29 15:36:23 2019 +0200 +++ b/net/server_epoll.lua Sun Sep 29 15:41:01 2019 +0200 @@ -793,17 +793,13 @@ -- Dump all data from one connection into another local function link(from, to, read_size) from:debug("Linking to %s", to.id); - from.listeners = setmetatable({ - onincoming = function (_, data) - from:pause(); + function from:onincoming(data) + self:pause(); to:write(data); - end, - }, {__index=from.listeners}); - to.listeners = setmetatable({ - ondrain = function () + end + function to:ondrain() from:resume(); - end, - }, {__index=to.listeners}); + end from:set_mode(read_size); from:set(true, nil); to:set(nil, true);