|
|
@ -578,18 +578,20 @@ void xmlrpc_kill_calls(void *p) { |
|
|
int status; |
|
|
int status; |
|
|
|
|
|
|
|
|
while (xh->tags) { |
|
|
while (xh->tags) { |
|
|
|
|
|
mylog(LOG_INFO, "Forking child to close call with tag %s via XMLRPC", (char *) xh->tags->data); |
|
|
pid = fork(); |
|
|
pid = fork(); |
|
|
|
|
|
|
|
|
if (pid) { |
|
|
if (pid) { |
|
|
retry: |
|
|
retry: |
|
|
pid = waitpid(pid, &status, 0); |
|
|
pid = waitpid(pid, &status, 0); |
|
|
if ((pid > 0 && WIFEXITED(status)) || i >= 3) { |
|
|
|
|
|
|
|
|
if ((pid > 0 && WIFEXITED(status) && WEXITSTATUS(status) == 0) || i >= 3) { |
|
|
xh->tags = g_slist_delete_link(xh->tags, xh->tags); |
|
|
xh->tags = g_slist_delete_link(xh->tags, xh->tags); |
|
|
i = 0; |
|
|
i = 0; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
if (pid == -1 && errno == EINTR) |
|
|
if (pid == -1 && errno == EINTR) |
|
|
goto retry; |
|
|
goto retry; |
|
|
|
|
|
mylog(LOG_INFO, "XMLRPC child exited with status %i", status); |
|
|
i++; |
|
|
i++; |
|
|
} |
|
|
} |
|
|
continue; |
|
|
continue; |
|
|
@ -599,10 +601,14 @@ retry: |
|
|
rlim(RLIMIT_CORE, 0); |
|
|
rlim(RLIMIT_CORE, 0); |
|
|
sigemptyset(&ss); |
|
|
sigemptyset(&ss); |
|
|
sigprocmask(SIG_SETMASK, &ss, NULL); |
|
|
sigprocmask(SIG_SETMASK, &ss, NULL); |
|
|
|
|
|
closelog(); |
|
|
|
|
|
|
|
|
for (i = 0; i < 100; i++) |
|
|
for (i = 0; i < 100; i++) |
|
|
close(i); |
|
|
close(i); |
|
|
|
|
|
|
|
|
|
|
|
openlog("mediaproxy-ng/child", LOG_PID | LOG_NDELAY, LOG_DAEMON); |
|
|
|
|
|
mylog(LOG_INFO, "Initiating XMLRPC call for tag %s", (char *) xh->tags->data); |
|
|
|
|
|
|
|
|
alarm(5); |
|
|
alarm(5); |
|
|
|
|
|
|
|
|
xmlrpc_env_init(&e); |
|
|
xmlrpc_env_init(&e); |
|
|
@ -610,18 +616,25 @@ retry: |
|
|
xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-mediaproxy-ng", MEDIAPROXY_VERSION, |
|
|
xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-mediaproxy-ng", MEDIAPROXY_VERSION, |
|
|
NULL, 0, &c); |
|
|
NULL, 0, &c); |
|
|
if (e.fault_occurred) |
|
|
if (e.fault_occurred) |
|
|
abort(); |
|
|
|
|
|
|
|
|
goto fault; |
|
|
|
|
|
|
|
|
|
|
|
r = NULL; |
|
|
xmlrpc_client_call2f(&e, c, xh->url, "di", &r, "(ssss)", |
|
|
xmlrpc_client_call2f(&e, c, xh->url, "di", &r, "(ssss)", |
|
|
"sbc", "postControlCmd", xh->tags->data, "teardown"); |
|
|
"sbc", "postControlCmd", xh->tags->data, "teardown"); |
|
|
if (r) |
|
|
if (r) |
|
|
xmlrpc_DECREF(r); |
|
|
xmlrpc_DECREF(r); |
|
|
|
|
|
if (e.fault_occurred) |
|
|
|
|
|
goto fault; |
|
|
|
|
|
|
|
|
xmlrpc_client_destroy(c); |
|
|
xmlrpc_client_destroy(c); |
|
|
xh->tags = g_slist_delete_link(xh->tags, xh->tags); |
|
|
xh->tags = g_slist_delete_link(xh->tags, xh->tags); |
|
|
xmlrpc_env_clean(&e); |
|
|
xmlrpc_env_clean(&e); |
|
|
|
|
|
|
|
|
_exit(0); |
|
|
_exit(0); |
|
|
|
|
|
|
|
|
|
|
|
fault: |
|
|
|
|
|
mylog(LOG_WARNING, "XMLRPC fault occurred: %s", e.fault_string); |
|
|
|
|
|
_exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
g_string_chunk_free(xh->c); |
|
|
g_string_chunk_free(xh->c); |
|
|
|