Implement a flag to enable fallback always
On some machines we want our watchdog running as long as the
phosphor-watchdog daemon is alive. This patch adds an option to enter
fallback mode any time the watchdog expires or is set to be disabled.
Change-Id: Ic96d2f15c761aeb4e25158c5bd861076cca6497d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/watchdog.hpp b/watchdog.hpp
index 60bad4e..7603689 100644
--- a/watchdog.hpp
+++ b/watchdog.hpp
@@ -37,6 +37,7 @@
struct Fallback {
Action action;
uint64_t interval;
+ bool always;
};
/** @brief Constructs the Watchdog object
@@ -60,7 +61,9 @@
fallback(std::move(fallback)),
timer(event, std::bind(&Watchdog::timeOutHandler, this))
{
- // Nothing
+ // We need to poke the enable mechanism to make sure that the timer
+ // enters the fallback state if the fallback is always enabled.
+ tryFallbackOrDisable();
}
/** @brief Since we are overriding the setter-enabled but not the