Comparison

plugins/mod_smacks.lua @ 12504:c589874fe348

mod_smacks: Initialize queue before sending <enable> Setting the .smacks field enables code paths that expects the queue to be present. The queue is initialized in wrap_session_out(). With opportunistic writes enabled this happens immediately on .sends2s(), so the sending <enable> must happen before OR after these two lines, not in the middle.
author Kim Alvefur <zash@zash.se>
date Sun, 15 May 2022 16:12:34 +0200
parent 12471:a3b12eeedd4b
child 12518:73ee3855f970
comparison
equal deleted inserted replaced
12503:ad49bb3a4780 12504:c589874fe348
332 module:hook("s2sout-established", function (event) 332 module:hook("s2sout-established", function (event)
333 local session = event.session; 333 local session = event.session;
334 if not session.smacks_feature then return end 334 if not session.smacks_feature then return end
335 335
336 session.smacks = session.smacks_feature.attr.xmlns; 336 session.smacks = session.smacks_feature.attr.xmlns;
337 wrap_session_out(session, false);
337 session.sends2s(st.stanza("enable", { xmlns = session.smacks })); 338 session.sends2s(st.stanza("enable", { xmlns = session.smacks }));
338 wrap_session_out(session, false);
339 end); 339 end);
340 340
341 function handle_enabled(session, stanza, xmlns_sm) -- luacheck: ignore 212/stanza 341 function handle_enabled(session, stanza, xmlns_sm) -- luacheck: ignore 212/stanza
342 module:log("debug", "Enabling stream management"); 342 module:log("debug", "Enabling stream management");
343 session.smacks = xmlns_sm; 343 session.smacks = xmlns_sm;