]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1095] Revert "[#1095] Protected communication state timer concurrent accesses"
authorFrancis Dupont <fdupont@isc.org>
Fri, 24 Apr 2020 19:07:28 +0000 (21:07 +0200)
committerRazvan Becheriu <razvan@isc.org>
Wed, 6 May 2020 09:46:31 +0000 (12:46 +0300)
This reverts commit d76566d0157911b2edb193a6e1e865d233094b8a.

src/hooks/dhcp/high_availability/communication_state.cc
src/hooks/dhcp/high_availability/communication_state.h

index a0414c8d7840e834f3656428daaa652664815c47..f948976a29833f76a80accfa1798efc7f3b80d62 100644 (file)
@@ -46,8 +46,7 @@ namespace ha {
 
 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_(),
@@ -94,7 +93,6 @@ CommunicationState::setPartnerScopes(ConstElementPtr new_scopes) {
 void
 CommunicationState::startHeartbeat(const long interval,
                                    const boost::function<void()>& heartbeat_impl) {
-    std::lock_guard<std::mutex> lock(*timer_mutex_);
     startHeartbeatInternal(interval, heartbeat_impl);
 }
 
@@ -141,7 +139,6 @@ CommunicationState::startHeartbeatInternal(const long interval,
 
 void
 CommunicationState::stopHeartbeat() {
-    std::lock_guard<std::mutex> lock(*timer_mutex_);
     if (timer_) {
         timer_->cancel();
         timer_.reset();
@@ -162,7 +159,6 @@ CommunicationState::poke() {
     // 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
index 9d0966dc54eababd2d0e29ca3ca656e06e14b4a9..1ced58daec15cb94ceeace696247928c16a5bd9c 100644 (file)
@@ -1,4 +1,4 @@
-// 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
@@ -17,7 +17,6 @@
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
 #include <map>
-#include <mutex>
 #include <set>
 #include <string>
 
@@ -135,7 +134,6 @@ public:
     ///
     /// @return true if heartbeat is running, false otherwise.
     bool isHeartbeatRunning() const {
-        std::lock_guard<std::mutex> lock(*timer_mutex_);
         return (static_cast<bool>(timer_));
     }
 
@@ -308,9 +306,6 @@ protected:
     /// @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_;