# HG changeset patch # User Kim Alvefur # Date 1639691991 -3600 # Node ID 31a7e0ac6928ea5c62fbb5f27e0e7e5998a2a3bb # Parent 3099e03b10bd78c61e148ce65e11d82857d02ae8 mod_smacks: Skip hibernation logic if session was closed or replaced The resumption_token is removed when the session is closed via the pre-session-close event, signaling that it cannot be resumed, and therefore no hibernation timeout logic should be invoked. Fixes that if a session somehow is replaced by a new one using the same resource (which is the common behavior), the old session would still be around until it times out at which point it sends `` which would look as if it came from the new session, ie appearing offline to everyone including MUCs. diff -r 3099e03b10bd -r 31a7e0ac6928 plugins/mod_smacks.lua --- a/plugins/mod_smacks.lua Thu Dec 16 22:42:08 2021 +0100 +++ b/plugins/mod_smacks.lua Thu Dec 16 22:59:51 2021 +0100 @@ -436,6 +436,10 @@ if session.destroyed then session.log("debug", "The session has already been destroyed"); return + elseif not session.resumption_token then + -- This should normally not happen, the watchdog should be canceled from session:close() + session.log("debug", "The session has already been resumed or replaced"); + return end session.log("debug", "Destroying session for hibernating too long");