Changeset

13023:cbe58f747d48

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Tue, 04 Apr 2023 08:55:15 +0200
parents 13020:3174308d127e (current diff) 13022:a313b7260145 (diff)
children 13024:7558fd152459
files plugins/mod_smacks.lua
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Sun Apr 02 21:58:53 2023 +0200
+++ b/plugins/mod_smacks.lua	Tue Apr 04 08:55:15 2023 +0200
@@ -521,7 +521,16 @@
 	if session.hibernating then return end
 
 	session.hibernating = os_time();
-	session.hibernating_watchdog = watchdog.new(resume_timeout, function()
+	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?
+			session.log("debug", "Releasing a stray watchdog");
+			return
+		end
 		session.log("debug", "mod_smacks hibernation timeout reached...");
 		if session.destroyed then
 			session.log("debug", "The session has already been destroyed");