Merge 0.10->trunk
[prosody.git] / plugins / mod_s2s / mod_s2s.lua
index 68042a5d67bf3d64f33d38ca8bfe391309cb2c0c..ff8ef45dcfbd6c2a2a195089ead5029c66204db7 100644 (file)
@@ -354,8 +354,13 @@ function stream_callbacks.streamopened(session, attr)
                                (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host");
                        end
 
-                       log("debug", "Sending stream features: %s", tostring(features));
-                       session.sends2s(features);
+                       if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then
+                               log("debug", "Sending stream features: %s", tostring(features));
+                               session.sends2s(features);
+                       else
+                               (session.log or log)("warn", "No features to offer, giving up");
+                               session:close({ condition = "undefined-condition", text = "No features to offer" });
+                       end
                end
        elseif session.direction == "outgoing" then
                session.notopen = nil;