浏览代码

lock syntax error

Philippe G 3 年之前
父节点
当前提交
523127bdea
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      components/spotify/cspot/src/MercuryManager.cpp

+ 5 - 4
components/spotify/cspot/src/MercuryManager.cpp

@@ -149,7 +149,7 @@ RECONNECT:
 
 void MercuryManager::runTask()
 {
-    std::scoped_lock(this->runningMutex);
+    std::scoped_lock lock(this->runningMutex);
     // Listen for mercury replies and handle them accordingly
     isRunning = true;
     while (isRunning)
@@ -161,9 +161,10 @@ void MercuryManager::runTask()
         }
         catch (const std::runtime_error& e)
         {
+			if (!isRunning) break;
             // Reconnection required
-            if (isRunning) this->reconnect();
-            if (isRunning) this->reconnectedCallback();
+            this->reconnect();
+            this->reconnectedCallback();
             continue;
         }
         if (static_cast<MercuryType>(packet->command) == MercuryType::PING) // @TODO: Handle time synchronization through ping
@@ -191,7 +192,7 @@ void MercuryManager::stop() {
     CSPOT_LOG(debug, "Stopping mercury manager");
     isRunning = false;
     audioChunkManager->close();
-    std::scoped_lock(audioChunkManager->runningMutex, this->runningMutex);
+    std::scoped_lock lock(audioChunkManager->runningMutex, this->runningMutex);
     CSPOT_LOG(debug, "mercury stopped");
 }