[asterisk-commits] pjsip resolver.c: Fix debug code to only execute at acceptab... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 10 19:39:43 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: pjsip_resolver.c: Fix debug code to only execute at acceptable debug level.
......................................................................


pjsip_resolver.c: Fix debug code to only execute at acceptable debug level.

Change-Id: I1716c93d6e097ad28128ecb9e806aac7a4180c8a
---
M res/res_pjsip/pjsip_resolver.c
1 file changed, 11 insertions(+), 9 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified
  Corey Farrell: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip/pjsip_resolver.c b/res/res_pjsip/pjsip_resolver.c
index e4cc51a..4573e4c 100644
--- a/res/res_pjsip/pjsip_resolver.c
+++ b/res/res_pjsip/pjsip_resolver.c
@@ -155,10 +155,9 @@
 
 	if (!resolve->queries) {
 		resolve->queries = ast_dns_query_set_create();
-	}
-
-	if (!resolve->queries) {
-		return -1;
+		if (!resolve->queries) {
+			return -1;
+		}
 	}
 
 	if (!port) {
@@ -186,15 +185,18 @@
 static int sip_resolve_invoke_user_callback(void *data)
 {
 	struct sip_resolve *resolve = data;
-	int idx;
 
-	for (idx = 0; idx < resolve->addresses.count; ++idx) {
+	if (DEBUG_ATLEAST(2)) {
 		/* This includes space for the IP address, [, ], :, and the port */
 		char addr[PJ_INET6_ADDRSTRLEN + 10];
+		int idx;
 
-		ast_debug(2, "[%p] Address '%d' is %s with transport '%s'\n",
-			resolve, idx, pj_sockaddr_print(&resolve->addresses.entry[idx].addr, addr, sizeof(addr), 3),
-			pjsip_transport_get_type_name(resolve->addresses.entry[idx].type));
+		for (idx = 0; idx < resolve->addresses.count; ++idx) {
+			pj_sockaddr_print(&resolve->addresses.entry[idx].addr, addr, sizeof(addr), 3);
+			ast_log(LOG_DEBUG, "[%p] Address '%d' is %s with transport '%s'\n",
+				resolve, idx, addr,
+				pjsip_transport_get_type_name(resolve->addresses.entry[idx].type));
+		}
 	}
 
 	ast_debug(2, "[%p] Invoking user callback with '%d' addresses\n", resolve, resolve->addresses.count);

-- 
To view, visit https://gerrit.asterisk.org/625
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1716c93d6e097ad28128ecb9e806aac7a4180c8a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list