Diff

plugins/mod_smacks.lua @ 13023:cbe58f747d48

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Tue, 04 Apr 2023 08:55:15 +0200
parent 12977:74b9e05af71e
parent 13022:a313b7260145
child 13209:c8d949cf6b09
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");