Software /
code /
prosody
Diff
plugins/mod_proxy65.lua @ 2310:e74c6740a42b
mod_proxy65: Make the proxying bidirectional
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> |
---|---|
date | Thu, 03 Dec 2009 17:05:35 +0100 (2009-12-03) |
parent | 2309:7dc6049a69e8 |
child | 2311:5fe837ebe542 |
line wrap: on
line diff
--- a/plugins/mod_proxy65.lua Thu Dec 03 17:04:54 2009 +0100 +++ b/plugins/mod_proxy65.lua Thu Dec 03 17:05:35 2009 +0100 @@ -55,8 +55,12 @@ 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 @@ 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