From: Kern Sibbald Date: Thu, 10 Jul 2014 06:50:34 +0000 (+0200) Subject: Fix possible heartbeat interval timing problems X-Git-Tag: Release-7.0.5~29 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=609906bd59bc1affb97cb1a6393ad679ee12d8dc;p=bacula%2Fbacula Fix possible heartbeat interval timing problems --- diff --git a/bacula/src/filed/heartbeat.c b/bacula/src/filed/heartbeat.c index b83eef9cad..9795049eab 100644 --- a/bacula/src/filed/heartbeat.c +++ b/bacula/src/filed/heartbeat.c @@ -109,7 +109,7 @@ void start_heartbeat_monitor(JCR *jcr) * it gives a constant stream of TIMEOUT_SIGNAL signals that * make debugging impossible. */ - if (!no_signals) { + if (!no_signals && (me->heartbeat_interval > 0)) { jcr->hb_bsock = NULL; jcr->hb_started = false; jcr->hb_dir_bsock = NULL; @@ -182,6 +182,10 @@ extern "C" void *dir_heartbeat_thread(void *arg) } last_heartbeat = now; } + /* This should never happen, but it might ... */ + if (next <= 0) { + next = 1; + } bmicrosleep(next, 0); } dir->destroy(); @@ -195,7 +199,7 @@ extern "C" void *dir_heartbeat_thread(void *arg) */ void start_dir_heartbeat(JCR *jcr) { - if (me->heartbeat_interval) { + if (!no_signals && (me->heartbeat_interval > 0)) { jcr->dir_bsock->set_locking(); pthread_create(&jcr->heartbeat_id, NULL, dir_heartbeat_thread, (void *)jcr); } @@ -203,7 +207,7 @@ void start_dir_heartbeat(JCR *jcr) void stop_dir_heartbeat(JCR *jcr) { - if (me->heartbeat_interval) { + if (me->heartbeat_interval > 0) { stop_heartbeat_monitor(jcr); } }