diff options
author | Sascha Philipp <sascha.philipp@continental-corporation.com> | 2014-04-24 10:16:22 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2015-03-25 17:12:05 +0100 |
commit | 0975b0196f8614d00661ae05089e35b0505b602b (patch) | |
tree | 2cc819d2bd25f8531ccff07e913190bea2c14eae /src/daemon | |
parent | fe775798ca3cfe8f0f8355b9bc7b1d325a876035 (diff) | |
download | DLT-daemon-0975b0196f8614d00661ae05089e35b0505b602b.tar.gz |
Fix watchdog timeout
Change-Id: Id6fe1a4948c7ca87e53042829f6b7eb7b9eec975
Signed-off-by: Ralf Anton Beier <ralf.anton.beier@continental-corporation.com>
Signed-off-by: Sascha Philipp <sascha.philipp@continental-corporation.com>
(cherry picked from commit 7f7afbb8d49cbdb8f571ece8aac24bf584326910)
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/dlt-daemon.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index fea6a4f..df6c567 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -71,6 +71,10 @@ static char str[DLT_DAEMON_TEXTBUFSIZE]; static int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local, char *str, int verbose); +#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE +static uint32_t watchdog_trigger_interval; // watchdog trigger interval in [s] +#endif + /** * Print usage information of tool. @@ -466,6 +470,7 @@ int main(int argc, char* argv[]) { watchdogTimeoutSeconds = atoi(watchdogUSec)/2000000; } + watchdog_trigger_interval = watchdogTimeoutSeconds; create_timer_fd(&daemon_local, watchdogTimeoutSeconds, watchdogTimeoutSeconds, &daemon_local.timer_wd, "Systemd watchdog"); } #endif @@ -2538,6 +2543,9 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem int ret; static uint8_t data[DLT_DAEMON_RCVBUFSIZE]; int length; +#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE + uint32_t curr_time; +#endif PRINT_FUNCTION_VERBOSE(verbose); @@ -2553,8 +2561,26 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem return DLT_DAEMON_ERROR_OK; } +#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE + if(sd_notify(0, "WATCHDOG=1") < 0) + { + dlt_log(LOG_WARNING, "Could not reset systemd watchdog\n"); + } + curr_time = dlt_uptime(); +#endif while ( (length = dlt_buffer_copy(&(daemon->client_ringbuffer), data, sizeof(data)) ) > 0) { +#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE + if ((dlt_uptime() - curr_time) / 10000 >= watchdog_trigger_interval) + { + if(sd_notify(0, "WATCHDOG=1") < 0) + { + dlt_log(LOG_WARNING, "Could not reset systemd watchdog\n"); + } + curr_time = dlt_uptime(); + } +#endif + if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_FORCE,daemon,daemon_local,data,length,0,0,verbose,0))) { return ret; |