]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1239] communication state is now Kea thread safe
authorRazvan Becheriu <razvan@isc.org>
Thu, 4 Jun 2020 21:39:46 +0000 (00:39 +0300)
committerRazvan Becheriu <razvan@isc.org>
Tue, 16 Jun 2020 09:02:52 +0000 (09:02 +0000)
src/hooks/dhcp/high_availability/communication_state.cc

index 9bac62e578916a3ef893de814981fb800523999c..80f82e6352c55328d87e4ab7745eebb1893ee55b 100644 (file)
@@ -359,7 +359,8 @@ CommunicationState::getReport() const {
 
 CommunicationState4::CommunicationState4(const IOServicePtr& io_service,
                                          const HAConfigPtr& config)
-    : CommunicationState(io_service, config), connecting_clients_() {
+    : CommunicationState(io_service, config), connecting_clients_(),
+      mutex_(new mutex()) {
 }
 
 void
@@ -465,7 +466,7 @@ CommunicationState4::failureDetected() const {
 bool
 CommunicationState4::failureDetectedInternal() const {
     return ((config_->getMaxUnackedClients() == 0) ||
-            (getUnackedClientsCount() > config_->getMaxUnackedClients()));
+            (getUnackedClientsCountInternal() > config_->getMaxUnackedClients()));
 }
 
 size_t
@@ -515,7 +516,8 @@ CommunicationState4::clearConnectingClientsInternal() {
 
 CommunicationState6::CommunicationState6(const IOServicePtr& io_service,
                                          const HAConfigPtr& config)
-    : CommunicationState(io_service, config), connecting_clients_() {
+    : CommunicationState(io_service, config), connecting_clients_(),
+      mutex_(new mutex()){
 }
 
 void
@@ -609,7 +611,7 @@ CommunicationState6::failureDetected() const {
 bool
 CommunicationState6::failureDetectedInternal() const {
     return ((config_->getMaxUnackedClients() == 0) ||
-            (getUnackedClientsCount() > config_->getMaxUnackedClients()));
+            (getUnackedClientsCountInternal() > config_->getMaxUnackedClients()));
 }
 
 size_t