Changeset

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 4538:591c643d55b2
children 4540:3aab4e3ab06f
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
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);