Browse Source

More relax JackEngine::NotifyAddClient.

tags/1.9.8
Stephane Letz 14 years ago
parent
commit
5ebeb196af
6 changed files with 15 additions and 9 deletions
  1. +2
    -0
      common/JackClient.cpp
  2. +3
    -1
      common/JackDriver.cpp
  3. +3
    -3
      common/JackEngine.cpp
  4. +4
    -4
      common/JackExternalClient.cpp
  5. +1
    -1
      posix/JackPosixSemaphore.cpp
  6. +2
    -0
      posix/JackSocket.cpp

+ 2
- 0
common/JackClient.cpp View File

@@ -149,6 +149,8 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
{ {
int res = 0; int res = 0;


jack_log("JackClient::ClientNotify ref = %ld name = %s notify = %ld", refnum, name, notify);

// Done all time: redirected on subclass implementation JackLibClient and JackInternalClient // Done all time: redirected on subclass implementation JackLibClient and JackInternalClient
switch (notify) { switch (notify) {




+ 3
- 1
common/JackDriver.cpp View File

@@ -217,6 +217,8 @@ void JackDriver::SetupDriverSync(int ref, bool freewheel)


int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2) int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
{ {
jack_log("JackDriver::ClientNotify ref = %ld driver = %s name = %s notify = %ld", refnum, fClientControl.fName, name, notify);

switch (notify) { switch (notify) {


case kStartFreewheelCallback: case kStartFreewheelCallback:
@@ -228,7 +230,7 @@ int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync,
jack_log("JackDriver::kStopFreewheel"); jack_log("JackDriver::kStopFreewheel");
SetupDriverSync(fClientControl.fRefNum, false); SetupDriverSync(fClientControl.fRefNum, false);
break; break;
}
}


return 0; return 0;
} }


+ 3
- 3
common/JackEngine.cpp View File

@@ -275,10 +275,10 @@ int JackEngine::NotifyAddClient(JackClientInterface* new_client, const char* nam
// Notify existing clients of the new client and new client of existing clients. // Notify existing clients of the new client and new client of existing clients.
for (int i = 0; i < CLIENT_NUM; i++) { for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* old_client = fClientTable[i]; JackClientInterface* old_client = fClientTable[i];
if (old_client) {
if (old_client && old_client != new_client) {
if (old_client->ClientNotify(refnum, name, kAddClient, true, "", 0, 0) < 0) { if (old_client->ClientNotify(refnum, name, kAddClient, true, "", 0, 0) < 0) {
jack_error("NotifyAddClient old_client fails name = %s", old_client->GetClientControl()->fName); jack_error("NotifyAddClient old_client fails name = %s", old_client->GetClientControl()->fName);
return -1;
// Not considered as a failure...
} }
if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, kAddClient, true, "", 0, 0) < 0) { if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, kAddClient, true, "", 0, 0) < 0) {
jack_error("NotifyAddClient new_client fails name = %s", name); jack_error("NotifyAddClient new_client fails name = %s", name);
@@ -296,7 +296,7 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum)
for (int i = 0; i < CLIENT_NUM; i++) { for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i]; JackClientInterface* client = fClientTable[i];
if (client) { if (client) {
client->ClientNotify(refnum, name, kRemoveClient, true, "",0, 0);
client->ClientNotify(refnum, name, kRemoveClient, true, "", 0, 0);
} }
} }
} }


+ 4
- 4
common/JackExternalClient.cpp View File

@@ -36,7 +36,7 @@ JackExternalClient::~JackExternalClient()
int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2) int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
{ {
int result = -1; int result = -1;
jack_log("JackExternalClient::ClientNotify ref = %ld name = %s notify = %ld", refnum, name, notify);
jack_log("JackExternalClient::ClientNotify ref = %ld client = %s name = %s notify = %ld", refnum, fClientControl->fName, name, notify);
fChannel.ClientNotify(refnum, name, notify, sync, message, value1, value2, &result); fChannel.ClientNotify(refnum, name, notify, sync, message, value1, value2, &result);
return result; return result;
} }
@@ -49,17 +49,17 @@ int JackExternalClient::Open(const char* name, int pid, int refnum, int uuid, in
jack_error("Cannot connect to client name = %s\n", name); jack_error("Cannot connect to client name = %s\n", name);
return -1; return -1;
} }
// Use "placement new" to allocate object in shared memory // Use "placement new" to allocate object in shared memory
JackShmMemAble* shared_mem = static_cast<JackShmMemAble*>(JackShmMem::operator new(sizeof(JackClientControl))); JackShmMemAble* shared_mem = static_cast<JackShmMemAble*>(JackShmMem::operator new(sizeof(JackClientControl)));
shared_mem->Init(); shared_mem->Init();
fClientControl = new(shared_mem) JackClientControl(name, pid, refnum, uuid); fClientControl = new(shared_mem) JackClientControl(name, pid, refnum, uuid);
if (!fClientControl) { if (!fClientControl) {
jack_error("Cannot allocate client shared memory segment"); jack_error("Cannot allocate client shared memory segment");
return -1; return -1;
} }
*shared_client = shared_mem->GetShmIndex(); *shared_client = shared_mem->GetShmIndex();
jack_log("JackExternalClient::Open name = %s index = %ld base = %x", name, shared_mem->GetShmIndex(), shared_mem->GetShmAddress()); jack_log("JackExternalClient::Open name = %s index = %ld base = %x", name, shared_mem->GetShmIndex(), shared_mem->GetShmAddress());
return 0; return 0;


+ 1
- 1
posix/JackPosixSemaphore.cpp View File

@@ -187,7 +187,7 @@ bool JackPosixSemaphore::ConnectOutput(const char* name, const char* server_name
bool JackPosixSemaphore::Disconnect() bool JackPosixSemaphore::Disconnect()
{ {
if (fSemaphore) { if (fSemaphore) {
jack_log("JackPosixSemaphore::Disconnect name = %s", fName);
jack_log("JackPosixSemaphore::Disconnect name = %s", fName);
if (sem_close(fSemaphore) != 0) { if (sem_close(fSemaphore) != 0) {
jack_error("Disconnect: can't disconnect named semaphore name = %s err = %s", fName, strerror(errno)); jack_error("Disconnect: can't disconnect named semaphore name = %s err = %s", fName, strerror(errno));
return false; return false;


+ 2
- 0
posix/JackSocket.cpp View File

@@ -188,6 +188,7 @@ int JackClientSocket::Read(void* data, int len)
jack_error("Cannot read socket fd = %d err = %s", fSocket, strerror(errno)); jack_error("Cannot read socket fd = %d err = %s", fSocket, strerror(errno));
return 0; return 0;
} else { } else {
jack_error("Cannot read socket fd = %d err = %s", fSocket, strerror(errno));
return -1; return -1;
} }
} else { } else {
@@ -232,6 +233,7 @@ int JackClientSocket::Write(void* data, int len)
jack_error("Cannot write socket fd = %ld err = %s", fSocket, strerror(errno)); jack_error("Cannot write socket fd = %ld err = %s", fSocket, strerror(errno));
return 0; return 0;
} else { } else {
jack_error("Cannot write socket fd = %ld err = %s", fSocket, strerror(errno));
return -1; return -1;
} }
} else { } else {


Loading…
Cancel
Save