diff options
Diffstat (limited to 'core/src/filed/heartbeat.cc')
-rw-r--r-- | core/src/filed/heartbeat.cc | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/core/src/filed/heartbeat.cc b/core/src/filed/heartbeat.cc index 9f5440562..64a091f48 100644 --- a/core/src/filed/heartbeat.cc +++ b/core/src/filed/heartbeat.cc @@ -3,7 +3,7 @@ Copyright (C) 2003-2012 Free Software Foundation Europe e.V. Copyright (C) 2011-2012 Planets Communications B.V. - Copyright (C) 2013-2020 Bareos GmbH & Co. KG + Copyright (C) 2013-2022 Bareos GmbH & Co. KG This program is Free Software; you can redistribute it and/or modify it under the terms of version three of the GNU Affero General Public @@ -30,7 +30,7 @@ #include "include/bareos.h" #include "filed/filed.h" -#include "filed/jcr_private.h" +#include "filed/filed_jcr_impl.h" #include "filed/filed_globals.h" #include "lib/bnet.h" #include "lib/bsock.h" @@ -63,12 +63,12 @@ extern "C" void* sd_heartbeat_thread(void* arg) sd.reset(jcr->store_bsock->clone()); dir.reset(jcr->dir_bsock->clone()); - jcr->impl->hb_bsock = sd; - jcr->impl->hb_running = true; - jcr->impl->hb_dir_bsock = dir; + jcr->fd_impl->hb_bsock = sd; + jcr->fd_impl->hb_running = true; + jcr->fd_impl->hb_dir_bsock = dir; dir->suppress_error_msgs_ = true; sd->suppress_error_msgs_ = true; - jcr->impl->hb_initialized_once + jcr->fd_impl->hb_initialized_once = true; // initialize last to avoid race condition /* Hang reading the socket to the SD, and every time we get @@ -102,9 +102,9 @@ extern "C" void* sd_heartbeat_thread(void* arg) sd->close(); dir->close(); - jcr->impl->hb_bsock.reset(); - jcr->impl->hb_running = false; - jcr->impl->hb_dir_bsock = NULL; + jcr->fd_impl->hb_bsock.reset(); + jcr->fd_impl->hb_running = false; + jcr->fd_impl->hb_dir_bsock = NULL; return NULL; } @@ -118,11 +118,11 @@ void StartHeartbeatMonitor(JobControlRecord* jcr) * make debugging impossible. */ if (!no_signals) { - jcr->impl->hb_bsock = NULL; - jcr->impl->hb_running = false; - jcr->impl->hb_initialized_once = false; - jcr->impl->hb_dir_bsock = NULL; - pthread_create(&jcr->impl->heartbeat_id, NULL, sd_heartbeat_thread, + jcr->fd_impl->hb_bsock = NULL; + jcr->fd_impl->hb_running = false; + jcr->fd_impl->hb_initialized_once = false; + jcr->fd_impl->hb_dir_bsock = NULL; + pthread_create(&jcr->fd_impl->heartbeat_id, NULL, sd_heartbeat_thread, (void*)jcr); } } @@ -134,47 +134,47 @@ void StopHeartbeatMonitor(JobControlRecord* jcr) if (no_signals) { return; } /* Wait max 10 secs for heartbeat thread to start */ - while (!jcr->impl->hb_initialized_once && cnt++ < 200) { + while (!jcr->fd_impl->hb_initialized_once && cnt++ < 200) { Bmicrosleep(0, 50000); /* wait for start */ } - if (jcr->impl->hb_running) { - jcr->impl->hb_bsock->SetTimedOut(); /* set timed_out to Terminate read */ - jcr->impl->hb_bsock->SetTerminated(); /* set to Terminate read */ + if (jcr->fd_impl->hb_running) { + jcr->fd_impl->hb_bsock->SetTimedOut(); /* set timed_out to Terminate read */ + jcr->fd_impl->hb_bsock->SetTerminated(); /* set to Terminate read */ } - if (jcr->impl->hb_dir_bsock) { - jcr->impl->hb_dir_bsock + if (jcr->fd_impl->hb_dir_bsock) { + jcr->fd_impl->hb_dir_bsock ->SetTimedOut(); /* set timed_out to Terminate read */ - jcr->impl->hb_dir_bsock->SetTerminated(); /* set to Terminate read */ + jcr->fd_impl->hb_dir_bsock->SetTerminated(); /* set to Terminate read */ } - if (jcr->impl->hb_running) { + if (jcr->fd_impl->hb_running) { Dmsg0(100, "Send kill to heartbeat id\n"); - pthread_kill(jcr->impl->heartbeat_id, + pthread_kill(jcr->fd_impl->heartbeat_id, TIMEOUT_SIGNAL); /* make heartbeat thread go away */ Bmicrosleep(0, 50000); } cnt = 0; // Wait max 100 secs for heartbeat thread to stop - while (jcr->impl->hb_running && cnt++ < 200) { - pthread_kill(jcr->impl->heartbeat_id, + while (jcr->fd_impl->hb_running && cnt++ < 200) { + pthread_kill(jcr->fd_impl->heartbeat_id, TIMEOUT_SIGNAL); /* make heartbeat thread go away */ Bmicrosleep(0, 500000); } - if (jcr->impl->hb_bsock) { - // delete jcr->impl_->hb_bsock; - jcr->impl->hb_bsock.reset(); + if (jcr->fd_impl->hb_bsock) { + // delete jcr->fd_impl_->hb_bsock; + jcr->fd_impl->hb_bsock.reset(); } - if (jcr->impl->hb_dir_bsock) { - // delete jcr->impl_->hb_dir_bsock; - jcr->impl->hb_dir_bsock.reset(); + if (jcr->fd_impl->hb_dir_bsock) { + // delete jcr->fd_impl_->hb_dir_bsock; + jcr->fd_impl->hb_dir_bsock.reset(); } - jcr->impl->hb_initialized_once = false; + jcr->fd_impl->hb_initialized_once = false; } /** @@ -193,10 +193,10 @@ extern "C" void* dir_heartbeat_thread(void* arg) // Get our own local copy dir = jcr->dir_bsock->clone(); - jcr->impl->hb_bsock.reset(dir); - jcr->impl->hb_running = true; + jcr->fd_impl->hb_bsock.reset(dir); + jcr->fd_impl->hb_running = true; dir->suppress_error_msgs_ = true; - jcr->impl->hb_initialized_once + jcr->fd_impl->hb_initialized_once = true; // initialize last to avoid race condition while (!dir->IsStop()) { @@ -212,8 +212,8 @@ extern "C" void* dir_heartbeat_thread(void* arg) Bmicrosleep(next, 0); } dir->close(); - jcr->impl->hb_bsock.reset(); - jcr->impl->hb_running = false; + jcr->fd_impl->hb_bsock.reset(); + jcr->fd_impl->hb_running = false; return NULL; } @@ -222,7 +222,7 @@ void StartDirHeartbeat(JobControlRecord* jcr) { if (me->heartbeat_interval) { jcr->dir_bsock->SetLocking(); - pthread_create(&jcr->impl->heartbeat_id, NULL, dir_heartbeat_thread, + pthread_create(&jcr->fd_impl->heartbeat_id, NULL, dir_heartbeat_thread, (void*)jcr); } } |