[Asterisk-code-review] pjsip resolver.c: Fix debug code to only execute at acceptab... (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Wed Jun 10 13:08:55 CDT 2015
Richard Mudgett has uploaded a new change for review.
https://gerrit.asterisk.org/625
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(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/25/625/1
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: newchange
Gerrit-Change-Id: I1716c93d6e097ad28128ecb9e806aac7a4180c8a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list