Commit a7001745 authored by sletz's avatar sletz
Browse files

Simplify request server close only if server is running implementation.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2765 0c269be4-1314-0410-8aa9-9f06e86f4224
parent ba0d1103
......@@ -75,7 +75,6 @@ JackClient::JackClient(JackSynchro* table):fThread(this)
fSyncArg = NULL;
fTimebaseArg = NULL;
fThreadFunArg = NULL;
fServerRunning = false;
}
JackClient::~JackClient()
......@@ -85,15 +84,17 @@ int JackClient::Close()
{
jack_log("JackClient::Close ref = %ld", GetClientControl()->fRefNum);
int result = 0;
Deactivate();
fChannel->Stop(); // Channels is stopped first to avoid receiving notifications while closing
// Request close only is server is still running
if (fServerRunning) {
if (GetClientControl()->fServer) {
fChannel->ClientClose(GetClientControl()->fRefNum, &result);
} else {
jack_log("JackClient::Close server is shutdown");
}
fChannel->Close();
fSynchroTable[GetClientControl()->fRefNum].Disconnect();
return result;
......@@ -581,9 +582,11 @@ ShutDown is called:
void JackClient::ShutDown()
{
jack_log("ShutDown");
fServerRunning = false;
GetClientControl()->fServer = false;
GetClientControl()->fActive = false;
if (fShutdown) {
GetClientControl()->fActive = false;
fShutdown(fShutdownArg);
fShutdown = NULL;
}
......
......@@ -43,6 +43,7 @@ struct JackClientControl : public JackShmMemAble
int fRefNum;
int fPID;
bool fActive;
bool fServer;
JackClientControl(const char* name, int pid, int refnum)
{
......@@ -77,6 +78,7 @@ struct JackClientControl : public JackShmMemAble
fTransportSync = false;
fTransportTimebase = false;
fActive = false;
fServer = true;
}
};
......
......@@ -147,7 +147,6 @@ int JackInternalClient::Open(const char* server_name, const char* name, jack_opt
}
SetupDriverSync(false);
fServerRunning = true;
return 0;
error:
......
......@@ -118,7 +118,6 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_
}
jack_log("JackLibClient::Open name = %s refnum = %ld", name_res, GetClientControl()->fRefNum);
fServerRunning = true;
return 0;
error:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment