summaryrefslogtreecommitdiffstats
path: root/app/watchdog_service.cpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-04-27 14:31:08 -0700
committerEmily Shaffer <emilyshaffer@google.com>2018-05-22 18:22:06 +0000
commit4b017a9b8728d19880d8d0de9cb994d7c0273769 (patch)
treee28d5fcdc02cbb5b50a1343d81fa78d696d9052c /app/watchdog_service.cpp
parentd541027d4bc1f7f0fa00411d5eead606d476dbc2 (diff)
downloadphosphor-host-ipmid-4b017a9b8728d19880d8d0de9cb994d7c0273769.tar.gz
phosphor-host-ipmid-4b017a9b8728d19880d8d0de9cb994d7c0273769.zip
watchdog: Use ResetTimeRemaining for wd_reset
Using this helper method reduces the number of dbus calls made during each watchdog reset. Change-Id: I373db3babe03e05fca33eb4dbbbc7c07f95a39ea Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'app/watchdog_service.cpp')
-rw-r--r--app/watchdog_service.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index c95c092..26962dc 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -32,6 +32,28 @@ WatchdogService::WatchdogService()
{
}
+void WatchdogService::resetTimeRemaining(bool enableWatchdog)
+{
+ bool wasValid = wd_service.isValid(bus);
+ auto request = wd_service.newMethodCall(
+ bus, wd_intf, "ResetTimeRemaining");
+ request.append(enableWatchdog);
+ auto response = bus.call(request);
+ if (response.is_method_error())
+ {
+ wd_service.invalidate();
+ if (wasValid)
+ {
+ // Retry the request once in case the cached service was stale
+ return resetTimeRemaining(enableWatchdog);
+ }
+ log<level::ERR>(
+ "WatchdogService: Method error resetting time remaining",
+ entry("ENABLE_WATCHDOG=%d", !!enableWatchdog));
+ elog<InternalFailure>();
+ }
+}
+
WatchdogService::Properties WatchdogService::getProperties()
{
bool wasValid = wd_service.isValid(bus);
OpenPOWER on IntegriCloud