Software /
code /
prosody
Diff
plugins/mod_s2s/mod_s2s.lua @ 6146:ac4f8770d9aa
mod_s2s: Follow XMPP Core on when a stream is to be considered ready
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 22 Apr 2014 21:56:06 +0200 |
parent | 6085:2f911644f527 |
child | 6255:6167f8bc5a6b |
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua Mon Apr 21 02:43:09 2014 +0200 +++ b/plugins/mod_s2s/mod_s2s.lua Tue Apr 22 21:56:06 2014 +0200 @@ -150,6 +150,13 @@ module:hook("route/remote", route_to_new_session, -10); module:hook("s2s-authenticated", make_authenticated, -1); module:hook("s2s-read-timeout", keepalive, -1); + module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) + if session.type == "s2sout" then + -- Stream is authenticated and we are seem to be done with feature negotiation, + -- so the stream is ready for stanzas. RFC 6120 Section 4.3 + mark_connected(session); + end + end, -1); end -- Stream is authorised, and ready for normal stanzas @@ -219,7 +226,10 @@ end session.log("debug", "connection %s->%s is now authenticated for %s", session.from_host, session.to_host, host); - mark_connected(session); + if (session.type == "s2sout" and session.external_auth ~= "succeeded") or session.type == "s2sin" then + -- Stream either used dialback for authentication or is an incoming stream. + mark_connected(session); + end return true; end