From 2ad1d6f65e4acd78d732c52b9f3ca8af0061e78a Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 6 Aug 2012 15:23:18 +0000 Subject: [PATCH] xmlrpc still segfaulting. leaves no choice but to fork out a new process, ugh. --- daemon/call.c | 24 +++++++++++++++++++++--- daemon/main.c | 9 --------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 9e77758dd..2f878f122 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "call.h" #include "poller.h" @@ -546,10 +547,25 @@ void xmlrpc_kill_calls(void *p) { xmlrpc_env e; xmlrpc_client *c; xmlrpc_value *r; - - xmlrpc_env_init(&e); + pid_t pid; + sigset_t ss; while (xh->tags) { + pid = fork(); + + if (pid) { + waitpid(pid, NULL, 0); + xh->tags = g_slist_delete_link(xh->tags, xh->tags); + continue; + } + + /* child process */ + sigemptyset(&ss); + sigprocmask(SIG_SETMASK, &ss, NULL); + alarm(5); + + xmlrpc_env_init(&e); + xmlrpc_client_setup_global_const(&e); xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-mediaproxy-ng", MEDIAPROXY_VERSION, NULL, 0, &c); if (e.fault_occurred) @@ -562,11 +578,13 @@ void xmlrpc_kill_calls(void *p) { xmlrpc_client_destroy(c); xh->tags = g_slist_delete_link(xh->tags, xh->tags); + xmlrpc_env_clean(&e); + + _exit(0); } g_string_chunk_free(xh->c); g_slice_free1(sizeof(*xh), xh); - xmlrpc_env_clean(&e); } void kill_calls_timer(GSList *list, struct callmaster *m) { diff --git a/daemon/main.c b/daemon/main.c index 6e20e7655..551dd32fe 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "poller.h" #include "control.h" @@ -309,17 +308,9 @@ static void wpidfile(void) { static void init_everything() { - xmlrpc_env e; - g_thread_init(NULL); signals(); resources(); - - xmlrpc_env_init(&e); - xmlrpc_client_setup_global_const(&e); - if (e.fault_occurred) - abort(); - xmlrpc_env_clean(&e); }