diff options
author | Tobias Markmann <tm@ayena.de> | 2009-11-29 23:04:19 +0100 |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2009-11-29 23:04:19 +0100 |
commit | b7799b239e6ff80e2c12afdc3762bf76c9f148f7 (patch) | |
tree | 8094b218434219c93def88bfe8437f3eededefc1 /plugins/mod_compression.lua | |
parent | c7c629d9c8eda79fd6fd2d7e57f528d028554a50 (diff) | |
download | prosody-b7799b239e6ff80e2c12afdc3762bf76c9f148f7.tar.gz prosody-b7799b239e6ff80e2c12afdc3762bf76c9f148f7.zip |
mod_compression: Make setup_compression work for s2s sessions too.
Diffstat (limited to 'plugins/mod_compression.lua')
-rw-r--r-- | plugins/mod_compression.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 2a6c0871..aecfaedb 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -109,9 +109,9 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress -- setup compression for session.w local function setup_compression(session) - local old_send = session.send; - - session.send = function(t) + local old_send = (session.sends2s or session.send); + + local new_send = function(t) local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); if status == false then session:close({ @@ -124,6 +124,9 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress end old_send(compressed); end; + + if session.sends2s then session.sends2s = new_send + elseif session.send then session.send = new_send end end setup_compression(session); |