Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Thu, 24 Sep 2015 18:15:19 +0000 (20:15 +0200)
committerKim Alvefur <zash@zash.se>
Thu, 24 Sep 2015 18:15:19 +0000 (20:15 +0200)
1  2 
plugins/mod_s2s/mod_s2s.lua

index 68042a5d67bf3d64f33d38ca8bfe391309cb2c0c,b44000a639e2e2a8e66465bbf2273dd0dd709f35..ff8ef45dcfbd6c2a2a195089ead5029c66204db7
@@@ -56,9 -56,6 +56,9 @@@ local function bounce_sendq(session, re
                        (session.log or log)("error", "Replying to to an s2s error reply, please report this! Traceback: %s", traceback());
                end;
                dummy = true;
 +              close = function ()
 +                      (session.log or log)("error", "Attempting to close the dummy origin of s2s error replies, please report this! Traceback: %s", traceback());
 +              end;
        };
        for i, data in ipairs(sendq) do
                local reply = data[2];
@@@ -354,8 -351,13 +354,13 @@@ function stream_callbacks.streamopened(
                                (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;