mod_smacks: Fix stray watchdog closing sessions 0.12
authorKim Alvefur <zash@zash.se>
Sun, 02 Apr 2023 10:37:44 +0200
branch0.12
changeset 13025 14ca500f8621
parent 12927 419e55abd285
child 13026 a313b7260145
mod_smacks: Fix stray watchdog closing sessions Unsure exactly how this happens, but sometimes a watchdog appears to close a session that isn't hibernating, or hasn't hibernating long enough.
plugins/mod_smacks.lua
--- a/plugins/mod_smacks.lua	Sun Mar 05 15:45:01 2023 +0100
+++ b/plugins/mod_smacks.lua	Sun Apr 02 10:37:44 2023 +0200
@@ -474,7 +474,12 @@
 	if session.hibernating then return end
 
 	session.hibernating = os_time();
-	session.hibernating_watchdog = watchdog.new(resume_timeout, function()
+	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");