Changeset

13022:a313b7260145 0.12

mod_smacks: Replace existing watchdog when starting hibernation There shouldn't be one here but if there is, for some reason, it's better to close it than have it around to wake up and possibly try to destroy the session.
author Kim Alvefur <zash@zash.se>
date Sun, 02 Apr 2023 10:40:48 +0200
parents 13021:14ca500f8621
children 13023:cbe58f747d48 13057:20b1526772d2
files plugins/mod_smacks.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Sun Apr 02 10:37:44 2023 +0200
+++ b/plugins/mod_smacks.lua	Sun Apr 02 10:40:48 2023 +0200
@@ -474,6 +474,10 @@
 	if session.hibernating then return end
 
 	session.hibernating = os_time();
+	if session.hibernating_watchdog then
+		session.log("debug", "Session already has a sleeping watchdog, replacing it");
+		session.hibernating_watchdog:cancel();
+	end
 	session.hibernating_watchdog = watchdog.new(resume_timeout, function(this_dog)
 		if this_dog ~= session.hibernating_watchdog then
 			-- This really shouldn't happen?