fix: cleanly exit on shutdown (#5537)

Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
pajlada
2024-08-10 14:24:25 +02:00
committed by GitHub
parent daff83dde8
commit 74d65a345d
23 changed files with 134 additions and 65 deletions
@@ -150,6 +150,15 @@ protected:
return this->started_.load(std::memory_order_acquire);
}
/**
* @brief Will be called when the clients has been requested to stop
*
* Derived classes can override this to implement their own shutdown behaviour
*/
virtual void stopImpl()
{
}
liveupdates::WebsocketClient &websocketClient_;
private:
@@ -164,6 +173,8 @@ private:
{
assert(this->isStarted());
this->started_.store(false, std::memory_order_release);
this->stopImpl();
}
liveupdates::WebsocketHandle handle_;