Browse Source

Merge branch 'atomic-open'

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4503 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 14 years ago
parent
commit
38c7316efc
20 changed files with 74 additions and 52 deletions
  1. +4
    -0
      ChangeLog
  2. +1
    -1
      common/JackChannel.h
  3. +2
    -0
      common/JackClient.cpp
  4. +3
    -1
      common/JackDriver.cpp
  5. +5
    -6
      common/JackEngine.cpp
  6. +4
    -4
      common/JackExternalClient.cpp
  7. +2
    -2
      common/JackExternalClient.h
  8. +4
    -3
      common/JackInternalClient.cpp
  9. +1
    -1
      common/JackInternalClientChannel.h
  10. +4
    -4
      common/JackLibClient.cpp
  11. +2
    -4
      common/JackNetTool.cpp
  12. +7
    -4
      common/JackRequest.h
  13. +1
    -1
      posix/JackPosixSemaphore.cpp
  14. +2
    -0
      posix/JackSocket.cpp
  15. +6
    -5
      posix/JackSocketClientChannel.cpp
  16. +1
    -1
      posix/JackSocketClientChannel.h
  17. +4
    -1
      posix/JackSocketServerChannel.cpp
  18. +13
    -9
      windows/JackWinNamedPipeClientChannel.cpp
  19. +1
    -1
      windows/JackWinNamedPipeClientChannel.h
  20. +7
    -4
      windows/JackWinNamedPipeServerChannel.cpp

+ 4
- 0
ChangeLog View File

@@ -35,6 +35,10 @@ Chris Caudle
Jackdmp changes log Jackdmp changes log
--------------------------- ---------------------------


2011-07-23 Stephane Letz <letz@grame.fr>

* Possible fix for http://trac.jackaudio.org/ticket/193.

2011-07-22 Stephane Letz <letz@grame.fr> 2011-07-22 Stephane Letz <letz@grame.fr>


* NetJack2: improve error reporting. * NetJack2: improve error reporting.


+ 1
- 1
common/JackChannel.h View File

@@ -74,7 +74,7 @@ class JackClientChannelInterface
return -1; return -1;
} }


virtual void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
virtual void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
{} {}
virtual void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result) virtual void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{} {}


+ 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;
} }


+ 5
- 6
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);
} }
} }
} }
@@ -563,7 +563,6 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref
} else { } else {
strncpy(real_name, name, JACK_CLIENT_NAME_SIZE); strncpy(real_name, name, JACK_CLIENT_NAME_SIZE);
} }

EnsureUUID(uuid); EnsureUUID(uuid);
} }


@@ -686,12 +685,12 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai
int i; int i;


fGraphManager->GetInputPorts(refnum, ports); fGraphManager->GetInputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY); i++) {
PortUnRegister(refnum, ports[i]); PortUnRegister(refnum, ports[i]);
} }


fGraphManager->GetOutputPorts(refnum, ports); fGraphManager->GetOutputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY); i++) {
PortUnRegister(refnum, ports[i]); PortUnRegister(refnum, ports[i]);
} }




+ 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;


+ 2
- 2
common/JackExternalClient.h View File

@@ -38,8 +38,8 @@ class JackExternalClient : public JackClientInterface


private: private:


JackNotifyChannel fChannel; /*! Server/client communication channel */
JackClientControl* fClientControl; /*! Client control in shared memory */
JackNotifyChannel fChannel; /*! Server/client communication channel */
JackClientControl* fClientControl; /*! Client control in shared memory */


public: public:




+ 4
- 3
common/JackInternalClient.cpp View File

@@ -71,13 +71,14 @@ int JackInternalClient::Open(const char* server_name, const char* name, int uuid


strncpy(fServerName, server_name, sizeof(fServerName)); strncpy(fServerName, server_name, sizeof(fServerName));


fChannel->ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
fChannel->ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result, false);
if (result < 0) { if (result < 0) {
int status1 = *status; int status1 = *status;
if (status1 & JackVersionError)
if (status1 & JackVersionError) {
jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION); jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
else
} else {
jack_error("Client name = %s conflits with another running client", name); jack_error("Client name = %s conflits with another running client", name);
}
goto error; goto error;
} }




+ 1
- 1
common/JackInternalClientChannel.h View File

@@ -50,7 +50,7 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface
return 0; return 0;
} }


void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
{ {
*result = fEngine->ClientCheck(name, uuid, name_res, protocol, options, status); *result = fEngine->ClientCheck(name, uuid, name_res, protocol, options, status);
} }


+ 4
- 4
common/JackLibClient.cpp View File

@@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details. GNU Lesser General Public License for more details.


You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


*/ */
@@ -109,13 +109,13 @@ int JackLibClient::Open(const char* server_name, const char* name, int uuid, jac
} }


SetupDriverSync(false); SetupDriverSync(false);
// Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process // Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process
if (!fSynchroTable[GetClientControl()->fRefNum].Connect(name_res, fServerName)) { if (!fSynchroTable[GetClientControl()->fRefNum].Connect(name_res, fServerName)) {
jack_error("Cannot ConnectSemaphore %s client", name_res); jack_error("Cannot ConnectSemaphore %s client", name_res);
goto error; goto error;
} }
JackGlobals::fClientTable[GetClientControl()->fRefNum] = this; JackGlobals::fClientTable[GetClientControl()->fRefNum] = this;
JackGlobals::fServerRunning = true; JackGlobals::fServerRunning = true;
SetClockSource(GetEngineControl()->fClockSource); SetClockSource(GetEngineControl()->fClockSource);
@@ -146,7 +146,7 @@ int JackLibClient::ClientNotifyImp(int refnum, const char* name, int notify, int


case kRemoveClient: case kRemoveClient:
jack_log("JackClient::RemoveClient name = %s, ref = %ld ", name, refnum); jack_log("JackClient::RemoveClient name = %s, ref = %ld ", name, refnum);
if (strcmp(GetClientControl()->fName, name) != 0)
if (GetClientControl() && strcmp(GetClientControl()->fName, name) != 0)
res = fSynchroTable[refnum].Disconnect() ? 0 : -1; res = fSynchroTable[refnum].Disconnect() ? 0 : -1;
break; break;
} }


+ 2
- 4
common/JackNetTool.cpp View File

@@ -932,14 +932,12 @@ namespace Jack
WORD wVersionRequested = MAKEWORD(2, 2); WORD wVersionRequested = MAKEWORD(2, 2);
WSADATA wsaData; WSADATA wsaData;


if (WSAStartup(wVersionRequested, &wsaData) != 0)
{
if (WSAStartup(wVersionRequested, &wsaData) != 0) {
jack_error("WSAStartup error : %s", strerror(NET_ERROR_CODE)); jack_error("WSAStartup error : %s", strerror(NET_ERROR_CODE));
return -1; return -1;
} }


if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
{
if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
jack_error("Could not find a useable version of Winsock.dll\n"); jack_error("Could not find a useable version of Winsock.dll\n");
WSACleanup(); WSACleanup();
return -1; return -1;


+ 7
- 4
common/JackRequest.h View File

@@ -138,11 +138,12 @@ struct JackClientCheckRequest : public JackRequest
int fProtocol; int fProtocol;
int fOptions; int fOptions;
int fUUID; int fUUID;
int fOpen;


JackClientCheckRequest() JackClientCheckRequest()
{} {}
JackClientCheckRequest(const char* name, int protocol, int options, int uuid)
: JackRequest(JackRequest::kClientCheck), fProtocol(protocol), fOptions(options), fUUID(uuid)
JackClientCheckRequest(const char* name, int protocol, int options, int uuid, int open = false)
: JackRequest(JackRequest::kClientCheck), fProtocol(protocol), fOptions(options), fUUID(uuid), fOpen(open)
{ {
snprintf(fName, sizeof(fName), "%s", name); snprintf(fName, sizeof(fName), "%s", name);
} }
@@ -152,7 +153,8 @@ struct JackClientCheckRequest : public JackRequest
CheckRes(trans->Read(&fName, sizeof(fName))); CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fProtocol, sizeof(int))); CheckRes(trans->Read(&fProtocol, sizeof(int)));
CheckRes(trans->Read(&fOptions, sizeof(int))); CheckRes(trans->Read(&fOptions, sizeof(int)));
return trans->Read(&fUUID, sizeof(int));
CheckRes(trans->Read(&fUUID, sizeof(int)));
return trans->Read(&fOpen, sizeof(int));
} }


int Write(JackChannelTransaction* trans) int Write(JackChannelTransaction* trans)
@@ -161,7 +163,8 @@ struct JackClientCheckRequest : public JackRequest
CheckRes(trans->Write(&fName, sizeof(fName))); CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fProtocol, sizeof(int))); CheckRes(trans->Write(&fProtocol, sizeof(int)));
CheckRes(trans->Write(&fOptions, sizeof(int))); CheckRes(trans->Write(&fOptions, sizeof(int)));
return trans->Write(&fUUID, sizeof(int));
CheckRes(trans->Write(&fUUID, sizeof(int)));
return trans->Write(&fOpen, sizeof(int));
} }


}; };


+ 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 {


+ 6
- 5
posix/JackSocketClientChannel.cpp View File

@@ -62,13 +62,14 @@ int JackSocketClientChannel::Open(const char* server_name, const char* name, int
} }


// Check name in server // Check name in server
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result, true);
if (result < 0) { if (result < 0) {
int status1 = *status; int status1 = *status;
if (status1 & JackVersionError)
if (status1 & JackVersionError) {
jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION); jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
else
} else {
jack_error("Client name = %s conflits with another running client", name); jack_error("Client name = %s conflits with another running client", name);
}
goto error; goto error;
} }


@@ -141,9 +142,9 @@ void JackSocketClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res,
} }
} }


void JackSocketClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
void JackSocketClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
{ {
JackClientCheckRequest req(name, protocol, options, uuid);
JackClientCheckRequest req(name, protocol, options, uuid, open);
JackClientCheckResult res; JackClientCheckResult res;
ServerSyncCall(&req, &res, result); ServerSyncCall(&req, &res, result);
*status = res.fStatus; *status = res.fStatus;


+ 1
- 1
posix/JackSocketClientChannel.h View File

@@ -60,7 +60,7 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi


int ServerCheck(const char* server_name); int ServerCheck(const char* server_name);


void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result);
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open);
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result); void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, int uuid, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) void ClientOpen(const char* name, int* ref, int uuid, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{} {}


+ 4
- 1
posix/JackSocketServerChannel.cpp View File

@@ -164,7 +164,7 @@ bool JackSocketServerChannel::HandleRequest(int fd)
JackRequest header; JackRequest header;
if (header.Read(socket) < 0) { if (header.Read(socket) < 0) {
jack_log("HandleRequest: cannot read header"); jack_log("HandleRequest: cannot read header");
ClientKill(fd); // TO CHECK SOLARIS
ClientKill(fd);
return false; return false;
} }


@@ -185,6 +185,9 @@ bool JackSocketServerChannel::HandleRequest(int fd)
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus); res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
if (res.Write(socket) < 0) if (res.Write(socket) < 0)
jack_error("JackRequest::ClientCheck write error name = %s", req.fName); jack_error("JackRequest::ClientCheck write error name = %s", req.fName);
// Atomic ClientCheck followed by ClientOpen on same socket
if (req.fOpen)
HandleRequest(fd);
break; break;
} }




+ 13
- 9
windows/JackWinNamedPipeClientChannel.cpp View File

@@ -55,10 +55,10 @@ int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* nam


/* /*
16/08/07: was called before doing "fRequestPipe.Connect" .... still necessary? 16/08/07: was called before doing "fRequestPipe.Connect" .... still necessary?
if (fNotificationListenPipe.Bind(jack_client_dir, name, 0) < 0) {
jack_error("Cannot bind pipe");
goto error;
}
if (fNotificationListenPipe.Bind(jack_client_dir, name, 0) < 0) {
jack_error("Cannot bind pipe");
goto error;
}
*/ */


if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) { if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
@@ -67,10 +67,14 @@ int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* nam
} }


// Check name in server // Check name in server
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result, true);
if (result < 0) { if (result < 0) {
jack_error("Client name = %s conflits with another running client", name);
goto error;
int status1 = *status;
if (status1 & JackVersionError) {
jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
} else {
jack_error("Client name = %s conflits with another running client", name);
}
} }


if (fNotificationListenPipe.Bind(jack_client_dir, name_res, 0) < 0) { if (fNotificationListenPipe.Bind(jack_client_dir, name_res, 0) < 0) {
@@ -142,9 +146,9 @@ void JackWinNamedPipeClientChannel::ServerAsyncCall(JackRequest* req, JackResult
} }
} }


void JackWinNamedPipeClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
void JackWinNamedPipeClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
{ {
JackClientCheckRequest req(name, protocol, options, uuid);
JackClientCheckRequest req(name, protocol, options, uuid, open);
JackClientCheckResult res; JackClientCheckResult res;
ServerSyncCall(&req, &res, result); ServerSyncCall(&req, &res, result);
*status = res.fStatus; *status = res.fStatus;


+ 1
- 1
windows/JackWinNamedPipeClientChannel.h View File

@@ -59,7 +59,7 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,


int ServerCheck(const char* server_name); int ServerCheck(const char* server_name);


void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result);
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open);
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result); void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{} {}


+ 7
- 4
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -117,6 +117,9 @@ bool JackClientPipeThread::HandleRequest()
if (req.Read(fPipe) == 0) if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus); res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
res.Write(fPipe); res.Write(fPipe);
// Atomic ClientCheck followed by ClientOpen on same pipe
if (req.fOpen)
HandleRequest();
break; break;
} }


@@ -478,11 +481,11 @@ int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* ser
void JackWinNamedPipeServerChannel::Close() void JackWinNamedPipeServerChannel::Close()
{ {
/* TODO : solve WIN32 thread Kill issue /* TODO : solve WIN32 thread Kill issue
This would hang the server... since we are quitting it, its not really problematic,
all ressources will be deallocated at the end.
This would hang the server... since we are quitting it, its not really problematic,
all ressources will be deallocated at the end.


fRequestListenPipe.Close();
fThread.Stop();
fRequestListenPipe.Close();
fThread.Stop();
*/ */


fThread.Kill(); fThread.Kill();


Loading…
Cancel
Save