Changeset

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
parents 1190:c99d8b666eb4
children 1192:db4085433e5f
files mod_bidi/mod_bidi.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
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