From 71ffc7d50de6dba13c6860afd93dc405583d35d5 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Thu, 5 May 2022 15:53:14 +0200 Subject: [PATCH] Fix broken lock guards --- subscriptionstore.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subscriptionstore.cpp b/subscriptionstore.cpp index 31dd1ec..e0907da 100644 --- a/subscriptionstore.cpp +++ b/subscriptionstore.cpp @@ -300,7 +300,7 @@ std::shared_ptr SubscriptionStore::lockSession(const std::string &clien void SubscriptionStore::sendQueuedWillMessages() { const auto now = std::chrono::steady_clock::now(); - std::lock_guard(this->pendingWillsMutex); + std::lock_guard locker(this->pendingWillsMutex); auto it = pendingWillMessages.begin(); while (it != pendingWillMessages.end()) @@ -366,7 +366,7 @@ void SubscriptionStore::queueWillMessage(const std::shared_ptr &wil QueuedWill queuedWill(willMessage, session); - std::lock_guard(this->pendingWillsMutex); + std::lock_guard locker(this->pendingWillsMutex); auto pos = std::upper_bound(this->pendingWillMessages.begin(), this->pendingWillMessages.end(), willMessage, willDelayCompare); this->pendingWillMessages.insert(pos, queuedWill); } @@ -659,7 +659,7 @@ void SubscriptionStore::removeExpiredSessionsClients() int queuedRemovalsLeft = -1; { - std::lock_guard(this->queuedSessionRemovalsMutex); + std::lock_guard locker(this->queuedSessionRemovalsMutex); queuedRemovalsLeft = queuedSessionRemovals.size(); @@ -720,7 +720,7 @@ void SubscriptionStore::queueSessionRemoval(const std::shared_ptr &sess std::chrono::time_point removeAt = std::chrono::steady_clock::now() + std::chrono::seconds(session->getSessionExpiryInterval()); session->setQueuedRemovalAt(); - std::lock_guard(this->queuedSessionRemovalsMutex); + std::lock_guard locker(this->queuedSessionRemovalsMutex); queuedSessionRemovals[removeAt].push_back(session); } -- libgit2 0.21.4