From 02e4840b29580f5fbe6f03cdfc86d445e4454887 Mon Sep 17 00:00:00 2001 From: "roberto@precise64" Date: Sat, 10 Mar 2012 12:34:45 +0100 Subject: [PATCH] re-added --ignore-sigpipe --- plugins/fastrouter/fastrouter.c | 12 +++++++++--- uwsgi.c | 6 +++++- uwsgi.h | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/fastrouter/fastrouter.c b/plugins/fastrouter/fastrouter.c index d886dd7a..0d5da292 100644 --- a/plugins/fastrouter/fastrouter.c +++ b/plugins/fastrouter/fastrouter.c @@ -404,8 +404,6 @@ struct fastrouter_session *alloc_fr_session() { return uwsgi_calloc(sizeof(struct fastrouter_session)); } -void fastrouter_thread_loop(void *); - void fastrouter_loop(int id) { int i; @@ -432,7 +430,15 @@ void fastrouter_loop(int id) { if (!ufr.static_node_gracetime) ufr.static_node_gracetime = 30; - if (ufr.stats_server) { + int i_am_the_first = 1; + for(i=0;igateways[i].name, "uWSGI fastrouter")) { + i_am_the_first = 0; + break; + } + } + + if (ufr.stats_server && i_am_the_first) { char *tcp_port = strchr(ufr.stats_server, ':'); if (tcp_port) { // disable deferred accept for this socket diff --git a/uwsgi.c b/uwsgi.c index 35702394..943131e8 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -82,6 +82,8 @@ static struct uwsgi_option uwsgi_base_options[] = { {"endif", optional_argument, 0, "(opt logic) end if", uwsgi_opt_noop, NULL, UWSGI_OPT_IMMEDIATE}, + {"ignore-sigpipe", no_argument, 0, "do not report (annoying) SIGPIPE", uwsgi_opt_true, &uwsgi.ignore_sigpipe,0}, + {"inherit", required_argument, 0, "use the specified file as config template", uwsgi_opt_load, NULL,0}, {"daemonize", required_argument, 'd', "daemonize uWSGI", uwsgi_opt_set_str, &uwsgi.daemonize, 0}, {"daemonize2", required_argument, 0, "daemonize uWSGI after app loading", uwsgi_opt_set_str, &uwsgi.daemonize2, 0}, @@ -3001,7 +3003,9 @@ skipzero: uwsgi_unix_signal(SIGUSR1, stats); signal(SIGUSR2, (void *) &what_i_am_doing); - signal(SIGPIPE, (void *) &warn_pipe); + if (!uwsgi.ignore_sigpipe) { + signal(SIGPIPE, (void *) &warn_pipe); + } //initialization done diff --git a/uwsgi.h b/uwsgi.h index e936de05..cb3f8c48 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -1179,6 +1179,8 @@ struct uwsgi_server { int unshare; #endif + int ignore_sigpipe; + // still working on it char *profiler;