Software /
code /
prosody
Comparison
plugins/mod_smacks.lua @ 12069:b9e08cbd032b
mod_smacks: Add more logging
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 18 Dec 2021 12:50:09 +0100 |
parent | 12068:c3790ffdf467 |
child | 12070:e662c172ea0f |
comparison
equal
deleted
inserted
replaced
12068:c3790ffdf467 | 12069:b9e08cbd032b |
---|---|
198 end | 198 end |
199 | 199 |
200 module:hook("pre-session-close", function(event) | 200 module:hook("pre-session-close", function(event) |
201 local session = event.session; | 201 local session = event.session; |
202 if session.resumption_token then | 202 if session.resumption_token then |
203 session.log("debug", "Revoking resumption token"); | |
203 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; | 204 session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; |
204 old_session_registry:set(session.username, session.resumption_token, nil); | 205 old_session_registry:set(session.username, session.resumption_token, nil); |
205 session.resumption_token = nil; | 206 session.resumption_token = nil; |
207 else | |
208 session.log("debug", "Session not resumable"); | |
206 end | 209 end |
207 if session.hibernating_watchdog then | 210 if session.hibernating_watchdog then |
211 session.log("debug", "Removing sleeping watchdog"); | |
208 -- If the session is being replaced instead of resume, we don't want the | 212 -- If the session is being replaced instead of resume, we don't want the |
209 -- old session around to time out and cause trouble for the new session | 213 -- old session around to time out and cause trouble for the new session |
210 session.hibernating_watchdog:cancel(); | 214 session.hibernating_watchdog:cancel(); |
211 session.hibernating_watchdog = nil; | 215 session.hibernating_watchdog = nil; |
216 else | |
217 session.log("debug", "No watchdog set"); | |
212 end | 218 end |
213 -- send out last ack as per revision 1.5.2 of XEP-0198 | 219 -- send out last ack as per revision 1.5.2 of XEP-0198 |
214 if session.smacks and session.conn and session.handled_stanza_count then | 220 if session.smacks and session.conn and session.handled_stanza_count then |
215 (session.sends2s or session.send)(st.stanza("a", { | 221 (session.sends2s or session.send)(st.stanza("a", { |
216 xmlns = session.smacks; | 222 xmlns = session.smacks; |
488 :tag("item-not-found", { xmlns = xmlns_errors }) | 494 :tag("item-not-found", { xmlns = xmlns_errors }) |
489 ); | 495 ); |
490 end; | 496 end; |
491 else | 497 else |
492 if original_session.hibernating_watchdog then | 498 if original_session.hibernating_watchdog then |
499 original_session.log("debug", "Letting the watchdog go"); | |
493 original_session.hibernating_watchdog:cancel(); | 500 original_session.hibernating_watchdog:cancel(); |
494 original_session.hibernating_watchdog = nil; | 501 original_session.hibernating_watchdog = nil; |
502 else | |
503 original_session.log("error", "Hibernating session has no watchdog!") | |
495 end | 504 end |
496 session.log("debug", "mod_smacks resuming existing session %s...", get_session_id(original_session)); | 505 session.log("debug", "mod_smacks resuming existing session %s...", get_session_id(original_session)); |
497 original_session.log("debug", "mod_smacks session resumed from %s...", get_session_id(session)); | 506 original_session.log("debug", "mod_smacks session resumed from %s...", get_session_id(session)); |
498 -- TODO: All this should move to sessionmanager (e.g. session:replace(new_session)) | 507 -- TODO: All this should move to sessionmanager (e.g. session:replace(new_session)) |
499 if original_session.conn then | 508 if original_session.conn then |