diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-12-03 17:05:35 +0100 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-12-03 17:05:35 +0100 |
commit | 339c16a46f550c3b08350bfb1c4879f7f5e8a379 (patch) | |
tree | 294303b870900feb22f5ef6208d19f135f293ef4 | |
parent | d43c929cda623291e446d69587533c37d9b70233 (diff) | |
download | prosody-339c16a46f550c3b08350bfb1c4879f7f5e8a379.tar.gz prosody-339c16a46f550c3b08350bfb1c4879f7f5e8a379.zip |
mod_proxy65: Make the proxying bidirectional
-rw-r--r-- | plugins/mod_proxy65.lua | 11 |
1 files changed, 8 insertions, 3 deletions
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 |