Browse Source

Mercury should not reconnect when stopped

Philippe G 3 years ago
parent
commit
b79878f590
1 changed files with 3 additions and 3 deletions
  1. 3 3
      components/spotify/cspot/src/MercuryManager.cpp

+ 3 - 3
components/spotify/cspot/src/MercuryManager.cpp

@@ -9,7 +9,7 @@ std::map<MercuryType, std::string> MercuryTypeMap({
     {MercuryType::UNSUB, "UNSUB"},
     });
 
-MercuryManager::MercuryManager(std::unique_ptr<Session> session): bell::Task("mercuryManager", 4 * 1024, +1, 1)
+MercuryManager::MercuryManager(std::unique_ptr<Session> session): bell::Task("mercuryManager", 8 * 1024, +1, 1)
 {
     this->timeProvider = std::make_shared<TimeProvider>();
     this->callbacks = std::map<uint64_t, mercuryCallback>();
@@ -162,8 +162,8 @@ void MercuryManager::runTask()
         catch (const std::runtime_error& e)
         {
             // Reconnection required
-            this->reconnect();
-            this->reconnectedCallback();
+            if (isRunning) this->reconnect();
+            if (isRunning) this->reconnectedCallback();
             continue;
         }
         if (static_cast<MercuryType>(packet->command) == MercuryType::PING) // @TODO: Handle time synchronization through ping