From ef521030abbe529bba2693a2554892ca94b7b89e Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 17 Jan 2013 10:08:10 -0500 Subject: [PATCH 1/4] make viabranch in udp lookup optional --- daemon/call.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index fdb9f5c79..a0052c99c 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1693,15 +1693,22 @@ char *call_lookup_udp(const char **out, struct callmaster *m) { c = g_hash_table_lookup(m->callhash, out[RE_UDP_UL_CALLID]); if (c) mutex_lock(&c->lock); - if (!c || !g_hash_table_lookup(c->branches, out[RE_UDP_UL_VIABRANCH])) { - if (c) - mutex_unlock(&c->lock); + else + goto not_found; + + if (!out[RE_UDP_UL_VIABRANCH] || !*out[RE_UDP_UL_VIABRANCH]) + goto skip_branch; + + if (!g_hash_table_lookup(c->branches, out[RE_UDP_UL_VIABRANCH])) { + mutex_unlock(&c->lock); +not_found: rwlock_unlock_r(&m->hashlock); mylog(LOG_WARNING, LOG_PREFIX_CI "Got UDP LOOKUP for unknown call-id or unknown via-branch", out[RE_UDP_UL_CALLID], out[RE_UDP_UL_VIABRANCH]); xasprintf(&ret, "%s 0 " IPF "\n", out[RE_UDP_COOKIE], IPP(m->conf.ipv4)); return ret; } +skip_branch: obj_hold(c); rwlock_unlock_r(&m->hashlock); From b36afb618366484512755395af3a1e4ed51e2321 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 17 Jan 2013 10:16:57 -0500 Subject: [PATCH 2/4] exclude deprated API calls --- daemon/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/main.c b/daemon/main.c index 6ba5db78b..36341cedf 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -316,7 +316,9 @@ static void wpidfile(void) { static void init_everything() { +#if !GLIB_CHECK_VERSION(2,32,0) g_thread_init(NULL); +#endif openlog("mediaproxy-ng", LOG_PID | LOG_NDELAY, LOG_DAEMON); signals(); resources(); From cde509531c309d48c15e652369c89658cd123733 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 17 Jan 2013 10:17:59 -0500 Subject: [PATCH 3/4] parallel builds --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 706025395..18d3d107d 100755 --- a/debian/rules +++ b/debian/rules @@ -37,7 +37,7 @@ build: build-stamp build-stamp: dh_testdir make -C iptables-extension - make -C daemon + make -C daemon -j`nproc` touch $@ clean: From bca25d77003a21aa8ef9b690ae07ed023d8e25cc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 17 Jan 2013 11:13:17 -0500 Subject: [PATCH 4/4] make call_lookup_udp() remember viabranches like call_update_udp() --- daemon/call.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index a0052c99c..ac2cb90d5 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1591,7 +1591,7 @@ restart: rwlock_unlock_r(&m->hashlock); } - if (viabranch && !g_hash_table_lookup(c->branches, viabranch)) + if (viabranch && *viabranch && !g_hash_table_lookup(c->branches, viabranch)) g_hash_table_insert(c->branches, call_strdup(c, viabranch), (void *) 0x1); @@ -1688,31 +1688,29 @@ char *call_lookup_udp(const char **out, struct callmaster *m) { struct stream st; int num; char *ret; + const char *branch; rwlock_lock_r(&m->hashlock); c = g_hash_table_lookup(m->callhash, out[RE_UDP_UL_CALLID]); if (c) mutex_lock(&c->lock); - else - goto not_found; - - if (!out[RE_UDP_UL_VIABRANCH] || !*out[RE_UDP_UL_VIABRANCH]) - goto skip_branch; - - if (!g_hash_table_lookup(c->branches, out[RE_UDP_UL_VIABRANCH])) { - mutex_unlock(&c->lock); -not_found: + else { rwlock_unlock_r(&m->hashlock); mylog(LOG_WARNING, LOG_PREFIX_CI "Got UDP LOOKUP for unknown call-id or unknown via-branch", out[RE_UDP_UL_CALLID], out[RE_UDP_UL_VIABRANCH]); xasprintf(&ret, "%s 0 " IPF "\n", out[RE_UDP_COOKIE], IPP(m->conf.ipv4)); return ret; } -skip_branch: + obj_hold(c); rwlock_unlock_r(&m->hashlock); - log_info = out[RE_UDP_UL_VIABRANCH]; + branch = out[RE_UDP_UL_VIABRANCH]; + if (branch && *branch && !g_hash_table_lookup(c->branches, branch)) + g_hash_table_insert(c->branches, call_strdup(c, branch), + (void *) 0x1); + + log_info = branch; c->called_agent = "UNKNOWN(udp)"; if (addr_parse_udp(&st, out))