Mercurial > prosody-modules
diff mod_smacks/mod_smacks.lua @ 4539:4e7aa32f58d9
mod_smacks: Fix calculation of smacks timeout values
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Mon, 12 Apr 2021 14:50:28 +0200 |
parents | 53ee391ca689 |
children | f6f28ceff53a |
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua Sat Apr 10 01:16:02 2021 +0200 +++ b/mod_smacks/mod_smacks.lua Mon Apr 12 14:50:28 2021 +0200 @@ -506,9 +506,9 @@ session.log("debug", "No push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout); return resume_timeout; end - if current_time-timeout_start < resume_timeout and session.push_identifier ~= nil then - session.log("debug", "A push happened since hibernation started, hibernating session for up to %d extra seconds", current_time-timeout_start); - return current_time-timeout_start; -- time left to wait + if session.push_identifier ~= nil and current_time-timeout_start < resume_timeout then + session.log("debug", "A push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout-(current_time-timeout_start)); + return resume_timeout-(current_time-timeout_start); -- time left to wait end session.log("debug", "Destroying session for hibernating too long"); session_registry.set(session.username, session.resumption_token, nil);