Diff

plugins/mod_c2s.lua @ 7542:0f92dc8e8b88

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 08 Aug 2016 16:41:09 +0200
parent 7467:9a73c85baffe
parent 7540:e69df8093387
child 7666:03aa330562ed
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Sat Aug 06 11:58:01 2016 +0200
+++ b/plugins/mod_c2s.lua	Mon Aug 08 16:41:09 2016 +0200
@@ -261,9 +261,9 @@
 	function session.data(data)
 		-- Parse the data, which will store stanzas in session.pending_stanzas
 		if data then
-		data = filter("bytes/in", data);
-		if data then
-			local ok, err = stream:feed(data);
+			data = filter("bytes/in", data);
+			if data then
+				local ok, err = stream:feed(data);
 				if not ok then
 					log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_"));
 					session:close("not-well-formed");
@@ -309,7 +309,10 @@
 end
 
 local function keepalive(event)
-	return event.session.send(' ');
+	local session = event.session;
+	if not session.notopen then
+		return event.session.send(' ');
+	end
 end
 
 function listener.associate_session(conn, session)