Software /
code /
prosody
Comparison
plugins/mod_smacks.lua @ 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 |
parent | 13021:14ca500f8621 |
child | 13023:cbe58f747d48 |
comparison
equal
deleted
inserted
replaced
13021:14ca500f8621 | 13022:a313b7260145 |
---|---|
472 return | 472 return |
473 end | 473 end |
474 if session.hibernating then return end | 474 if session.hibernating then return end |
475 | 475 |
476 session.hibernating = os_time(); | 476 session.hibernating = os_time(); |
477 if session.hibernating_watchdog then | |
478 session.log("debug", "Session already has a sleeping watchdog, replacing it"); | |
479 session.hibernating_watchdog:cancel(); | |
480 end | |
477 session.hibernating_watchdog = watchdog.new(resume_timeout, function(this_dog) | 481 session.hibernating_watchdog = watchdog.new(resume_timeout, function(this_dog) |
478 if this_dog ~= session.hibernating_watchdog then | 482 if this_dog ~= session.hibernating_watchdog then |
479 -- This really shouldn't happen? | 483 -- This really shouldn't happen? |
480 session.log("debug", "Releasing a stray watchdog"); | 484 session.log("debug", "Releasing a stray watchdog"); |
481 return | 485 return |