Comparison

plugins/mod_smacks.lua @ 12062:4972244fe87b

mod_smacks: Cancel hibernation when session is closed To ensure that if a session is replaced after it has gone into hibernation, it does not come back and cause trouble for the new session (see previous commit).
author Kim Alvefur <zash@zash.se>
date Thu, 16 Dec 2021 23:04:50 +0100
parent 12061:31a7e0ac6928
child 12063:d308f6901397
comparison
equal deleted inserted replaced
12061:31a7e0ac6928 12062:4972244fe87b
222 local session = event.session; 222 local session = event.session;
223 if session.resumption_token then 223 if session.resumption_token then
224 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; 224 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil;
225 old_session_registry:set(session.username, session.resumption_token, nil); 225 old_session_registry:set(session.username, session.resumption_token, nil);
226 session.resumption_token = nil; 226 session.resumption_token = nil;
227 end
228 if session.hibernating_watchdog then
229 -- If the session is being replaced instead of resume, we don't want the
230 -- old session around to time out and cause trouble for the new session
231 session.hibernating_watchdog:cancel();
232 session.hibernating_watchdog = nil;
227 end 233 end
228 -- send out last ack as per revision 1.5.2 of XEP-0198 234 -- send out last ack as per revision 1.5.2 of XEP-0198
229 if session.smacks and session.conn and session.handled_stanza_count then 235 if session.smacks and session.conn and session.handled_stanza_count then
230 (session.sends2s or session.send)(st.stanza("a", { 236 (session.sends2s or session.send)(st.stanza("a", {
231 xmlns = session.smacks; 237 xmlns = session.smacks;