Diff

mod_bidi/mod_bidi.lua @ 1191:1818a7f08580

mod_bidi: Add missing 'is_bidi' flag for incoming s2s
author Kim Alvefur <zash@zash.se>
date Wed, 11 Sep 2013 21:43:49 +0200
parent 1129:ae0fa4d2005d
child 1387:db2ff8f29472
line wrap: on
line diff
--- a/mod_bidi/mod_bidi.lua	Mon Sep 09 15:46:51 2013 +0200
+++ b/mod_bidi/mod_bidi.lua	Wed Sep 11 21:43:49 2013 +0200
@@ -34,6 +34,7 @@
 			conflicting_session:close{ condition = "conflict", text = "Replaced by bidirectional stream" }
 		end
 		bidi_sessions[origin.from_host] = origin;
+		origin.is_bidi = true;
 	elseif origin.type == "s2sout" then -- handle incoming stanzas correctly
 		local bidi_session = {
 			type = "s2sin"; direction = "incoming";
@@ -66,9 +67,10 @@
 -- Incoming s2s
 module:hook("s2s-stream-features", function(event)
 	local origin, features = event.origin, event.features;
-	if not origin.is_bidi and not hosts[module.host].s2sout[origin.from_host]
-	and (not secure_only or origin.cert_chain_status == "valid"
-	and origin.cert_identity_status == "valid") then
+	if not origin.is_bidi and not origin.bidi_session and not origin.do_bidi
+	and not hosts[module.host].s2sout[origin.from_host]
+	and (not secure_only or (origin.cert_chain_status == "valid"
+	and origin.cert_identity_status == "valid")) then
 		module:log("debug", "Announcing support for bidirectional streams");
 		features:tag("bidi", { xmlns = xmlns_bidi_feature }):up();
 	end