X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_s2s%2Fmod_s2s.lua;h=a199d0ac76ea459c384053802f87142ad71ebcb7;hb=79a152bb61900a86c486b62d59be60fa845f8afc;hp=68042a5d67bf3d64f33d38ca8bfe391309cb2c0c;hpb=db6acd5d9321d3b6ad1132bd04d87190684065e0;p=prosody.git diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 68042a5d..a199d0ac 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -352,10 +352,16 @@ function stream_callbacks.streamopened(session, attr) hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features }); else (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"); + fire_global_event("s2s-stream-features-legacy", { origin = session, features = features }); 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; @@ -609,6 +615,11 @@ function listener.onstatus(conn, status) end end +function listener.ontimeout(conn) + -- Called instead of onconnect when the connection times out + measure_connections(1); +end + function listener.ondisconnect(conn, err) measure_connections(-1); local session = sessions[conn];