Changeset

3226:69e920d7c968

mod_compression: Move logging of compression/decompression errors to before the closing of the stream, to make logs a bit easier to follow
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 Jun 2010 16:47:17 +0100
parents 3224:9dd54a708523
children 3227:c80d052569c8
files plugins/mod_compression.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_compression.lua	Thu Jun 10 02:07:48 2010 +0100
+++ b/plugins/mod_compression.lua	Thu Jun 10 16:47:17 2010 +0100
@@ -98,12 +98,12 @@
 	add_filter(session, "bytes/out", function(t)
 		local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync');
 		if status == false then
+			module:log("warn", "%s", tostring(compressed));
 			session:close({
 				condition = "undefined-condition";
 				text = compressed;
 				extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed");
 			});
-			module:log("warn", "%s", tostring(compressed));
 			return;
 		end
 		return compressed;
@@ -115,12 +115,12 @@
 	add_filter(session, "bytes/in", function(data)
 		local status, decompressed, eof = pcall(inflate_stream, data);
 		if status == false then
+			module:log("warn", "%s", tostring(decompressed));
 			session:close({
 				condition = "undefined-condition";
 				text = decompressed;
 				extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed");
 			});
-			module:log("warn", "%s", tostring(decompressed));
 			return;
 		end
 		return decompressed;