From 339c16a46f550c3b08350bfb1c4879f7f5e8a379 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Thu, 3 Dec 2009 17:05:35 +0100 Subject: mod_proxy65: Make the proxying bidirectional --- plugins/mod_proxy65.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins/mod_proxy65.lua') diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index b6fce1c7..ab9eda57 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -55,8 +55,12 @@ function connlistener.onincoming(conn, data) if session.setup then if session.sha ~= nil and transfers[session.sha] ~= nil then local sha = session.sha; - if transfers[sha].activated == true and transfers[sha].initiator == conn and transfers[sha].target ~= nil then - transfers[sha].target:write(data); + if transfers[sha].activated == true and transfers[sha].target ~= nil then + if transfers[sha].initiator == conn then + transfers[sha].target:write(data); + else + transfers[sha].initiator:write(data); + end return; end end @@ -80,7 +84,8 @@ function connlistener.onincoming(conn, data) transfers[sha].initiator = conn; session.sha = sha; module:log("debug", "initiator connected ... "); - throttle_sending(conn, transfers[sha].target); + throttle_sending(conn, transfers[sha].target); + throttle_sending(transfers[sha].target, conn); end conn:write(string.char(5, 0, 0, 3, sha:len()) .. sha .. string.char(0, 0)); -- VER, REP, RSV, ATYP, BND.ADDR (sha), BND.PORT (2 Byte) else -- cgit v1.2.3