CommunicationState::CommunicationState(const IOServicePtr& io_service,
const HAConfigPtr& config)
- : io_service_(io_service), config_(config), timer_(),
- timer_mutex_(new std::mutex()), interval_(0),
+ : io_service_(io_service), config_(config), timer_(), interval_(0),
poke_time_(boost::posix_time::microsec_clock::universal_time()),
heartbeat_impl_(0), partner_state_(-1), partner_scopes_(),
clock_skew_(0, 0, 0, 0), last_clock_skew_warn_(),
void
CommunicationState::startHeartbeat(const long interval,
const boost::function<void()>& heartbeat_impl) {
- std::lock_guard<std::mutex> lock(*timer_mutex_);
startHeartbeatInternal(interval, heartbeat_impl);
}
void
CommunicationState::stopHeartbeat() {
- std::lock_guard<std::mutex> lock(*timer_mutex_);
if (timer_) {
timer_->cancel();
timer_.reset();
// seems to be (re)established.
clearUnackedClients();
- std::lock_guard<std::mutex> lock(*timer_mutex_);
if (timer_) {
// Check the duration since last poke. If it is less than a second, we don't
// want to reschedule the timer. The only case when the poke time duration is
-// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <map>
-#include <mutex>
#include <set>
#include <string>
///
/// @return true if heartbeat is running, false otherwise.
bool isHeartbeatRunning() const {
- std::lock_guard<std::mutex> lock(*timer_mutex_);
return (static_cast<bool>(timer_));
}
/// @brief Interval timer triggering heartbeat commands.
asiolink::IntervalTimerPtr timer_;
- /// @brief Mutex to protect timer_ concurrent accesses.
- boost::shared_ptr<std::mutex> timer_mutex_;
-
/// @brief Interval specified for the heartbeat.
long interval_;