aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua14
1 files changed, 5 insertions, 9 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index c2eb7b1c..d2964888 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -793,17 +793,13 @@ end;
-- 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);