From f300e8ec187bdc1e8a5872db2c880134ac2fce37 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 2 Jul 2010 01:29:58 +0200 Subject: [PATCH] ignore SIGPIPE (like SIGCHLD) --- core/AmConfig.cpp | 1 + core/AmConfig.h | 2 ++ core/sems.cpp | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp index 8c0e4aa6..96e1a67f 100644 --- a/core/AmConfig.cpp +++ b/core/AmConfig.cpp @@ -94,6 +94,7 @@ vector AmConfig::CodecOrder; Dtmf::InbandDetectorType AmConfig::DefaultDTMFDetector = Dtmf::SEMSInternal; bool AmConfig::IgnoreSIGCHLD = true; +bool AmConfig::IgnoreSIGPIPE = true; int AmConfig::setSIPPort(const string& port) { diff --git a/core/AmConfig.h b/core/AmConfig.h index 225896b9..b8a0706b 100644 --- a/core/AmConfig.h +++ b/core/AmConfig.h @@ -145,6 +145,8 @@ struct AmConfig static bool IgnoreSIGCHLD; + static bool IgnoreSIGPIPE; + static bool LogSessions; static bool LogEvents; diff --git a/core/sems.cpp b/core/sems.cpp index df2f6e60..f1dfb6b7 100644 --- a/core/sems.cpp +++ b/core/sems.cpp @@ -207,6 +207,10 @@ static void signal_handler(int sig) return; } + if (sig == SIGPIPE && AmConfig::IgnoreSIGPIPE) { + return; + } + if (main_pid == getpid()) { if(!is_shutting_down.get()) { is_shutting_down.set(true);