Browse Source

Simplify server temporary mode : now use a JackTemporaryException.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3784 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 16 years ago
parent
commit
136672723a
10 changed files with 33 additions and 22 deletions
  1. +1
    -0
      ChangeLog
  2. +4
    -0
      common/JackArgParser.cpp
  3. +1
    -1
      common/JackEngine.cpp
  4. +19
    -1
      common/JackException.h
  5. +6
    -0
      common/JackLockedEngine.h
  6. +0
    -1
      common/JackServerGlobals.cpp
  7. +0
    -1
      common/JackServerGlobals.h
  8. +0
    -4
      macosx/JackMachServerChannel.cpp
  9. +1
    -6
      posix/JackSocketServerChannel.cpp
  10. +1
    -8
      windows/JackWinNamedPipeServerChannel.cpp

+ 1
- 0
ChangeLog View File

@@ -30,6 +30,7 @@ Paul Davis
* Better memory allocation error checking in ringbuffer.c, weak import improvements. * Better memory allocation error checking in ringbuffer.c, weak import improvements.
* Memory allocation error checking for jack_client_new and jack_client_open (server and client side). * Memory allocation error checking for jack_client_new and jack_client_open (server and client side).
* Memory allocation error checking in server for RPC. * Memory allocation error checking in server for RPC.
* Simplify server temporary mode : now use a JackTemporaryException.


2009-11-12 Stephane Letz <letz@grame.fr> 2009-11-12 Stephane Letz <letz@grame.fr>


+ 4
- 0
common/JackArgParser.cpp View File

@@ -128,6 +128,10 @@ namespace Jack {
return -1; return -1;
//else allocate and fill it //else allocate and fill it
argv = (char**)calloc (fArgv.size(), sizeof(char*)); argv = (char**)calloc (fArgv.size(), sizeof(char*));
if (argv == NULL)
{
return -1;
}
for ( unsigned int i = 0; i < fArgv.size(); i++ ) for ( unsigned int i = 0; i < fArgv.size(); i++ )
{ {
argv[i] = (char*)calloc(fArgv[i].length(), sizeof(char)); argv[i] = (char*)calloc(fArgv[i].length(), sizeof(char));


+ 1
- 1
common/JackEngine.cpp View File

@@ -119,7 +119,7 @@ void JackEngine::ReleaseRefnum(int ref)
// last client and temporay case: quit the server // last client and temporay case: quit the server
jack_log("JackEngine::ReleaseRefnum server quit"); jack_log("JackEngine::ReleaseRefnum server quit");
fEngineControl->fTemporary = false; fEngineControl->fTemporary = false;
JackServerGlobals::fKilled = true;
throw JackTemporaryException();
} }
} }
} }


+ 19
- 1
common/JackException.h View File

@@ -58,7 +58,25 @@ class SERVER_EXPORT JackException : public std::runtime_error {
}; };


/*! /*!
\brief Exception possibly thrown by Net Slaves.
\brief Exception thrown by JackEngine in temporary mode.
*/

class SERVER_EXPORT JackTemporaryException : public JackException {
public:
JackTemporaryException(const std::string& msg) : JackException(msg)
{}
JackTemporaryException(char* msg) : JackException(msg)
{}
JackTemporaryException(const char* msg) : JackException(msg)
{}
JackTemporaryException() : JackException("")
{}
};
/*!
\brief Exception possibly thrown by Net slaves.
*/ */


class SERVER_EXPORT JackNetException : public JackException { class SERVER_EXPORT JackNetException : public JackException {


+ 6
- 0
common/JackLockedEngine.h View File

@@ -22,6 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


#include "JackEngine.h" #include "JackEngine.h"
#include "JackMutex.h" #include "JackMutex.h"
#include "JackTools.h"
#include "JackException.h"


namespace Jack namespace Jack
{ {
@@ -33,6 +35,10 @@ namespace Jack
} catch(std::bad_alloc& e) { \ } catch(std::bad_alloc& e) { \
jack_error("Memory allocation error..."); \ jack_error("Memory allocation error..."); \
return -1; \ return -1; \
} catch(JackTemporaryException& e) { \
jack_error("JackTemporaryException : now quits..."); \
kill(JackTools::GetPID(), SIGINT); \
return -1; \
} catch (...) { \ } catch (...) { \
jack_error("Unknown error..."); \ jack_error("Unknown error..."); \
return -1; \ return -1; \


+ 0
- 1
common/JackServerGlobals.cpp View File

@@ -28,7 +28,6 @@ static char* server_name = NULL;
namespace Jack namespace Jack
{ {


bool JackServerGlobals::fKilled = false;
JackServer* JackServerGlobals::fInstance; JackServer* JackServerGlobals::fInstance;
unsigned int JackServerGlobals::fUserCount; unsigned int JackServerGlobals::fUserCount;
bool (* JackServerGlobals::on_device_acquire)(const char * device_name) = NULL; bool (* JackServerGlobals::on_device_acquire)(const char * device_name) = NULL;


+ 0
- 1
common/JackServerGlobals.h View File

@@ -36,7 +36,6 @@ class JackClient;


struct SERVER_EXPORT JackServerGlobals struct SERVER_EXPORT JackServerGlobals
{ {
static bool fKilled;
static JackServer* fInstance; static JackServer* fInstance;
static unsigned int fUserCount; static unsigned int fUserCount;
static bool (* on_device_acquire)(const char * device_name); static bool (* on_device_acquire)(const char * device_name);


+ 0
- 4
macosx/JackMachServerChannel.cpp View File

@@ -143,10 +143,6 @@ boolean_t JackMachServerChannel::MessageHandler(mach_msg_header_t* Request, mach
channel->ClientKill(Request->msgh_local_port); channel->ClientKill(Request->msgh_local_port);
} else { } else {
JackRPCEngine_server(Request, Reply); JackRPCEngine_server(Request, Reply);
// Issued by JackEngine::ReleaseRefnum when temporary mode is used
if (JackServerGlobals::fKilled) {
kill(JackTools::GetPID(), SIGINT);
}
} }
return true; return true;
} }


+ 1
- 6
posix/JackSocketServerChannel.cpp View File

@@ -396,12 +396,7 @@ bool JackSocketServerChannel::HandleRequest(int fd)
jack_error("Unknown request %ld", header.fType); jack_error("Unknown request %ld", header.fType);
break; break;
} }
// Issued by JackEngine::ReleaseRefnum when temporary mode is used
if (JackServerGlobals::fKilled) {
kill(JackTools::GetPID(), SIGINT);
}
return true; return true;
} }




+ 1
- 8
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -317,14 +317,7 @@ bool JackClientPipeThread::HandleRequest()
break; break;
} }
} }
/* TODO
// Issued by JackEngine::ReleaseRefnum when temporary mode is used
if (JackServerGlobals::fKilled) {
kill(JackTools::GetPID(), SIGINT);
}
*/

// Unlock the global mutex // Unlock the global mutex
ReleaseMutex(fMutex); ReleaseMutex(fMutex);
return ret; return ret;


Loading…
Cancel
Save