mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-28 18:32:38 +00:00
Had a couple issues that were preventing a clean shutdown. Seems fine now?
This commit is contained in:
parent
092147aad0
commit
c8e2d55631
@ -169,6 +169,7 @@ PlaybackService::PlaybackService(
|
||||
|
||||
PlaybackService::~PlaybackService() {
|
||||
playback::SavePlaybackContext(appPrefs, library, *this);
|
||||
this->messageQueue.Remove(this);
|
||||
savePreferences(*this, playbackPrefs);
|
||||
this->Stop();
|
||||
this->ResetRemotes();
|
||||
|
@ -76,7 +76,7 @@ namespace musik { namespace core { namespace audio {
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
musik::core::ILibraryPtr library);
|
||||
|
||||
~PlaybackService();
|
||||
virtual ~PlaybackService();
|
||||
|
||||
/* IMessageTarget */
|
||||
virtual void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
|
@ -85,6 +85,7 @@ static class PlaybackRemote : public IPlaybackRemote {
|
||||
|
||||
void CheckRunningStatus() {
|
||||
if (!thread && context.environment && context.playback && context.prefs && context.metadataProxy) {
|
||||
this->Start();
|
||||
thread.reset(new std::thread(std::bind(&PlaybackRemote::ThreadProc, this)));
|
||||
}
|
||||
else if (thread && (!context.environment || !context.playback || !context.prefs || !context.metadataProxy)) {
|
||||
@ -124,22 +125,22 @@ static class PlaybackRemote : public IPlaybackRemote {
|
||||
|
||||
private:
|
||||
void ThreadProc() {
|
||||
httpServer.Wait();
|
||||
webSocketServer.Wait();
|
||||
}
|
||||
|
||||
void Start() {
|
||||
if (context.prefs->GetBool(prefs::http_server_enabled.c_str(), true)) {
|
||||
httpServer.Start();
|
||||
}
|
||||
|
||||
if (context.prefs->GetBool(prefs::websocket_server_enabled.c_str(), true)) {
|
||||
webSocketServer.Start();
|
||||
}
|
||||
|
||||
httpServer.Wait();
|
||||
webSocketServer.Wait();
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
httpServer.Stop();
|
||||
webSocketServer.Stop();
|
||||
|
||||
if (this->thread) {
|
||||
this->thread->join();
|
||||
this->thread.reset();
|
||||
|
Loading…
x
Reference in New Issue
Block a user