Browse Source

global xmlrpc init must be done prior to any threading

git.mgm/mediaproxy-ng/2.1
Richard Fuchs 14 years ago
parent
commit
ddffe5eeec
2 changed files with 18 additions and 4 deletions
  1. +2
    -1
      daemon/call.c
  2. +16
    -3
      daemon/main.c

+ 2
- 1
daemon/call.c View File

@ -545,7 +545,6 @@ void xmlrpc_kill_calls(void *p) {
struct xmlrpc_curl_xportparms xcxpp; struct xmlrpc_curl_xportparms xcxpp;
xmlrpc_env_init(&e); xmlrpc_env_init(&e);
xmlrpc_client_setup_global_const(&e);
ZERO(xcxpp); ZERO(xcxpp);
xcxpp.timeout = 5000; /* 5 seconds */ xcxpp.timeout = 5000; /* 5 seconds */
@ -557,6 +556,8 @@ void xmlrpc_kill_calls(void *p) {
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,
&cp, XMLRPC_CPSIZE(transportparm_size), &c); &cp, XMLRPC_CPSIZE(transportparm_size), &c);
if (e.fault_occurred)
abort();
while (xh->tags) { while (xh->tags) {
xmlrpc_client_call2f(&e, c, xh->url, "di", &r, "(ssss)", xmlrpc_client_call2f(&e, c, xh->url, "di", &r, "(ssss)",


+ 16
- 3
daemon/main.c View File

@ -8,6 +8,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>
#include <xmlrpc_client.h>
#include "poller.h" #include "poller.h"
#include "control.h" #include "control.h"
@ -300,6 +301,20 @@ 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();
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
struct poller *p; struct poller *p;
struct callmaster *m; struct callmaster *m;
@ -311,10 +326,8 @@ int main(int argc, char **argv) {
void *dlh; void *dlh;
const char **strp; const char **strp;
init_everything();
options(&argc, &argv); options(&argc, &argv);
g_thread_init(NULL);
signals();
resources();
if (table >= 0 && kernel_create_table(table)) { if (table >= 0 && kernel_create_table(table)) {


Loading…
Cancel
Save