Mercurial > prosody-modules
comparison 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 |
comparison
equal
deleted
inserted
replaced
4538:591c643d55b2 | 4539:4e7aa32f58d9 |
---|---|
504 local timeout_start = math_max(session.hibernating, session.first_hibernated_push or session.hibernating); | 504 local timeout_start = math_max(session.hibernating, session.first_hibernated_push or session.hibernating); |
505 if session.push_identifier ~= nil and not session.first_hibernated_push then | 505 if session.push_identifier ~= nil and not session.first_hibernated_push then |
506 session.log("debug", "No push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout); | 506 session.log("debug", "No push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout); |
507 return resume_timeout; | 507 return resume_timeout; |
508 end | 508 end |
509 if current_time-timeout_start < resume_timeout and session.push_identifier ~= nil then | 509 if session.push_identifier ~= nil and current_time-timeout_start < resume_timeout then |
510 session.log("debug", "A push happened since hibernation started, hibernating session for up to %d extra seconds", current_time-timeout_start); | 510 session.log("debug", "A push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout-(current_time-timeout_start)); |
511 return current_time-timeout_start; -- time left to wait | 511 return resume_timeout-(current_time-timeout_start); -- time left to wait |
512 end | 512 end |
513 session.log("debug", "Destroying session for hibernating too long"); | 513 session.log("debug", "Destroying session for hibernating too long"); |
514 session_registry.set(session.username, session.resumption_token, nil); | 514 session_registry.set(session.username, session.resumption_token, nil); |
515 -- save only actual h value and username/host (for security) | 515 -- save only actual h value and username/host (for security) |
516 old_session_registry.set(session.username, session.resumption_token, { | 516 old_session_registry.set(session.username, session.resumption_token, { |