From 57f9eab9fc58f77bab4b53aa07f47e8f5caca7dc Mon Sep 17 00:00:00 2001 From: sletz Date: Wed, 19 Nov 2008 17:16:59 +0000 Subject: [PATCH] Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3090 0c269be4-1314-0410-8aa9-9f06e86f4224 --- common/JackLibGlobals.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/common/JackLibGlobals.h b/common/JackLibGlobals.h index 8c458505..74732f20 100644 --- a/common/JackLibGlobals.h +++ b/common/JackLibGlobals.h @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackTime.h" #include "JackError.h" #include +#include namespace Jack { @@ -43,7 +44,8 @@ struct JackLibGlobals { JackShmReadWritePtr fGraphManager; /*! Shared memory Port manager */ JackShmReadWritePtr fEngineControl; /*! Shared engine control */ // transport engine has to be writable - JackSynchro fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */ + JackSynchro fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */ + sigset_t fProcessSignals; static int fClientCount; static JackLibGlobals* fGlobals; @@ -54,6 +56,16 @@ struct JackLibGlobals JackMessageBuffer::Create(); fGraphManager = -1; fEngineControl = -1; + + // Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. + #ifdef WIN32 + // TODO + #else + sigset_t signals; + sigemptyset(&signals); + sigaddset(&signals, SIGPIPE); + sigprocmask(SIG_BLOCK, &signals, &fProcessSignals); + #endif } ~JackLibGlobals() @@ -63,6 +75,13 @@ struct JackLibGlobals fSynchroTable[i].Disconnect(); } JackMessageBuffer::Destroy(); + + // Restore old signal mask + #ifdef WIN32 + // TODO + #else + sigprocmask(SIG_BLOCK, &fProcessSignals, 0); + #endif } static void Init()