diff --git a/ChangeLog b/ChangeLog index d1ef571c..78bc7695 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,10 @@ Paul Davis Jackdmp changes log --------------------------- +2009-05-13 Stephane Letz + + * Reworked Torben Hohn fix for server restart issue on Windows. + 2009-05-11 Stephane Letz * New jack_free function added in jack.h. diff --git a/windows/JackWinNamedPipeClientChannel.cpp b/windows/JackWinNamedPipeClientChannel.cpp index 35755b45..b36f03e1 100644 --- a/windows/JackWinNamedPipeClientChannel.cpp +++ b/windows/JackWinNamedPipeClientChannel.cpp @@ -311,7 +311,6 @@ bool JackWinNamedPipeClientChannel::Execute() JackResult res; if (event.Read(&fNotificationListenPipe) < 0) { - fNotificationListenPipe.Close(); jack_error("JackWinNamedPipeClientChannel read fail"); goto error; } @@ -320,7 +319,6 @@ bool JackWinNamedPipeClientChannel::Execute() if (event.fSync) { if (res.Write(&fNotificationListenPipe) < 0) { - fNotificationListenPipe.Close(); jack_error("JackWinNamedPipeClientChannel write fail"); goto error; } @@ -328,6 +326,9 @@ bool JackWinNamedPipeClientChannel::Execute() return true; error: + // Close the pipes, server wont be able to create them otherwise. + fNotificationListenPipe.Close(); + fRequestPipe.Close(); fClient->ShutDown(); return false; } diff --git a/windows/JackWinSemaphore.cpp b/windows/JackWinSemaphore.cpp index 88236d49..8ce52d62 100644 --- a/windows/JackWinSemaphore.cpp +++ b/windows/JackWinSemaphore.cpp @@ -137,9 +137,9 @@ bool JackWinSemaphore::Allocate(const char* name, const char* server_name, int v return false; } else if (GetLastError() == ERROR_ALREADY_EXISTS) { jack_error("Allocate: named semaphore already exist name = %s", fName); - CloseHandle(fSemaphore); - fSemaphore = NULL; - return false; + // Try to open it + fSemaphore = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, fName); + return (fSemaphore != NULL); } else { return true; }