Software /
code /
prosody
Changeset
2284:491b89d6816b
mod_compression: Make setup_compression work for s2s sessions too.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Sun, 29 Nov 2009 23:04:19 +0100 |
parents | 2283:156bb00ba5c0 |
children | 2285:3dd7fdee9035 |
files | plugins/mod_compression.lua |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_compression.lua Sun Nov 29 22:18:06 2009 +0100 +++ b/plugins/mod_compression.lua Sun Nov 29 23:04:19 2009 +0100 @@ -109,9 +109,9 @@ -- 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 @@ 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);