Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10283:dff360d00dfa
net.server_epoll: Handle read size argument to link
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 29 Sep 2019 15:36:23 +0200 |
parent | 10282:05ba04725a15 |
child | 10284:cd669975031b |
comparison
equal
deleted
inserted
replaced
10282:05ba04725a15 | 10283:dff360d00dfa |
---|---|
789 conn:add(onreadable, onwritable); | 789 conn:add(onreadable, onwritable); |
790 return conn; | 790 return conn; |
791 end; | 791 end; |
792 | 792 |
793 -- Dump all data from one connection into another | 793 -- Dump all data from one connection into another |
794 local function link(from, to) | 794 local function link(from, to, read_size) |
795 from:debug("Linking to %s", to.id); | 795 from:debug("Linking to %s", to.id); |
796 from.listeners = setmetatable({ | 796 from.listeners = setmetatable({ |
797 onincoming = function (_, data) | 797 onincoming = function (_, data) |
798 from:pause(); | 798 from:pause(); |
799 to:write(data); | 799 to:write(data); |
802 to.listeners = setmetatable({ | 802 to.listeners = setmetatable({ |
803 ondrain = function () | 803 ondrain = function () |
804 from:resume(); | 804 from:resume(); |
805 end, | 805 end, |
806 }, {__index=to.listeners}); | 806 }, {__index=to.listeners}); |
807 from:set_mode(read_size); | |
807 from:set(true, nil); | 808 from:set(true, nil); |
808 to:set(nil, true); | 809 to:set(nil, true); |
809 end | 810 end |
810 | 811 |
811 -- COMPAT | 812 -- COMPAT |