Comparison

plugins/mod_s2s.lua @ 12806:751bdd412915

mod_s2s: Record stanza size limit advertised by other servers For future use, i.e. canceling sending of stanzas that exceed the limit
author Kim Alvefur <zash@zash.se>
date Tue, 16 Mar 2021 18:30:34 +0100
parent 12805:d96e24bd54e1
child 12807:f0f7b0c61465
comparison
equal deleted inserted replaced
12805:d96e24bd54e1 12806:751bdd412915
248 module:hook("route/remote", route_to_existing_session, -1); 248 module:hook("route/remote", route_to_existing_session, -1);
249 module:hook("route/remote", route_to_new_session, -10); 249 module:hook("route/remote", route_to_new_session, -10);
250 module:hook("s2s-authenticated", make_authenticated, -1); 250 module:hook("s2s-authenticated", make_authenticated, -1);
251 module:hook("s2s-read-timeout", keepalive, -1); 251 module:hook("s2s-read-timeout", keepalive, -1);
252 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza 252 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza
253 local limits = stanza:get_child("stanza-size-limit", "xmpp:prosody.im/stream/limits");
254 if limits then
255 session.outgoing_stanza_size_limit = tonumber(limits.attr.bytes);
256 end
253 if session.type == "s2sout" then 257 if session.type == "s2sout" then
254 -- Stream is authenticated and we are seem to be done with feature negotiation, 258 -- Stream is authenticated and we are seem to be done with feature negotiation,
255 -- so the stream is ready for stanzas. RFC 6120 Section 4.3 259 -- so the stream is ready for stanzas. RFC 6120 Section 4.3
256 mark_connected(session); 260 mark_connected(session);
257 return true; 261 return true;