From 22043b686fa6fb083e267bbee9f50334487c2bc9 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Sat, 4 Aug 2012 17:09:36 +0000 Subject: [PATCH] alarms arent usable in a threaded environment, so use curl internal timeout instead --- daemon/call.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index a13673e..dc2ecda 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -541,23 +541,34 @@ void xmlrpc_kill_calls(void *p) { xmlrpc_env e; xmlrpc_client *c; xmlrpc_value *r; + struct xmlrpc_clientparms cp; + struct xmlrpc_curl_xportparms xcxpp; 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); + + ZERO(xcxpp); + xcxpp.timeout = 5000; /* 5 seconds */ + + ZERO(cp); + cp.transport = "curl"; + cp.transportparmsP = &xcxpp; + cp.transportparm_size = XMLRPC_CXPSIZE(timeout); + + xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-mediaproxy-ng", MEDIAPROXY_VERSION, + &cp, XMLRPC_CPSIZE(transportparm_size), &c); while (xh->tags) { - alarm(2); xmlrpc_client_call2f(&e, c, xh->url, "di", &r, "(ssss)", "sbc", "postControlCmd", xh->tags->data, "teardown"); xmlrpc_DECREF(r); - alarm(0); xh->tags = g_slist_delete_link(xh->tags, xh->tags); } g_string_chunk_free(xh->c); g_slice_free1(sizeof(*xh), xh); + xmlrpc_client_destroy(c); } void kill_calls_timer(GSList *list, struct callmaster *m) {