From de14a027c06d93dadf05322529bec9d83f4cd181 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Fri, 9 Feb 2018 16:11:18 -0800 Subject: watchdog: Implement initialized using the new dbus interface This makes it possible for the phosphor-host-ipmi or any other watchdog managing daemon to report to the caller that the watchdog was not configured if the phosphor-watchdog daemon restarts for any reason. Change-Id: Iae3a8554c2f5d1cb89368f3ce14b3d44922599c0 Signed-off-by: William A. Kennington III --- app/watchdog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/watchdog.cpp') diff --git a/app/watchdog.cpp b/app/watchdog.cpp index d537683..f28ff80 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp @@ -28,6 +28,13 @@ ipmi_ret_t ipmi_app_watchdog_reset( WatchdogService wd_service; WatchdogService::Properties wd_prop = wd_service.getProperties(); + // Notify the caller if we haven't initialized our timer yet + // so it can configure actions and timeouts + if (!wd_prop.initialized) + { + return IPMI_WDOG_CC_NOT_INIT; + } + // Reset the countdown to make sure we don't expire our timer wd_service.setTimeRemaining(wd_prop.interval); @@ -114,6 +121,9 @@ ipmi_ret_t ipmi_app_watchdog_set( wd_service.setInterval(interval); wd_service.setTimeRemaining(interval); + // Mark as initialized so that future resets behave correctly + wd_service.setInitialized(true); + return IPMI_CC_OK; } catch (const std::domain_error &) -- cgit v1.2.1