diff options
-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); |