Skip to content

Commit

Permalink
media_server: watch for media services status
Browse files Browse the repository at this point in the history
* It's now calling CleanupDormantInfos when
  media_addon_server die.
  • Loading branch information
Numerio committed Jul 24, 2015
1 parent b43b20d commit 7337091
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/servers/media/media_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ char __dont_remove_copyright_from_binary[] = "Copyright (c) 2002, 2003 "
#include <Roster.h>
#include <MediaDefs.h>
#include <MediaFormats.h>
#include <MediaRoster.h>
#include <Messenger.h>

#include <syscalls.h>
Expand Down Expand Up @@ -112,9 +113,16 @@ ServerApp::ServerApp()
fControlThread = spawn_thread(_ControlThread, "media_server control", 105,
this);
resume_thread(fControlThread);

BMediaRoster* roster = BMediaRoster::Roster();
if (roster->StartWatching(BMessenger(this, this),
B_MEDIA_SERVER_QUIT) != B_OK) {
TRACE("ServerApp: can't watch for B_MEDIA_SERVER_QUIT");
}
}



ServerApp::~ServerApp()
{
TRACE("ServerApp::~ServerApp()\n");
Expand All @@ -127,6 +135,12 @@ ServerApp::~ServerApp()
delete gAppManager;
delete gNodeManager;
delete gMediaFilesManager;

BMediaRoster* roster = BMediaRoster::CurrentRoster();
if (roster->StopWatching(BMessenger(this, this),
B_MEDIA_SERVER_QUIT) != B_OK) {
TRACE("ServerApp: can't unwatch for B_MEDIA_SERVER_QUIT");
}
}


Expand Down Expand Up @@ -929,6 +943,11 @@ ServerApp::MessageReceived(BMessage* msg)
case MEDIA_SERVER_ADD_SYSTEM_BEEP_EVENT:
gMediaFilesManager->HandleAddSystemBeepEvent(msg);
break;

case B_MEDIA_SERVER_QUIT:
gNodeManager->CleanupDormantFlavorInfos();
break;

default:
BApplication::MessageReceived(msg);
printf("\nmedia_server: unknown message received:\n");
Expand Down

0 comments on commit 7337091

Please sign in to comment.