[asterisk-commits] file: branch group/dns r432525 - in /team/group/dns: main/ tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 6 12:35:12 CST 2015


Author: file
Date: Fri Mar  6 12:35:10 2015
New Revision: 432525

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432525
Log:
Tweak log messages and fix resolver_resolve_sync_off_nominal test so it unregisters the correct resolver at the end.

Modified:
    team/group/dns/main/dns_core.c
    team/group/dns/tests/test_dns.c

Modified: team/group/dns/main/dns_core.c
URL: http://svnview.digium.com/svn/asterisk/team/group/dns/main/dns_core.c?view=diff&rev=432525&r1=432524&r2=432525
==============================================================================
--- team/group/dns/main/dns_core.c (original)
+++ team/group/dns/main/dns_core.c Fri Mar  6 12:35:10 2015
@@ -148,23 +148,24 @@
 		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, no name provided\n");
 		return NULL;
 	} else if (rr_type > ns_t_max) {
-		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, resource record type '%d' exceeds maximum\n",
-			rr_type);
+		ast_log(LOG_ERROR, "Could not perform asynchronous resolution of '%s', resource record type '%d' exceeds maximum\n",
+			name, rr_type);
 		return NULL;
 	} else if (rr_type < 0) {
-		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, invalid resource record type '%d'\n",
-			rr_type);
+		ast_log(LOG_ERROR, "Could not perform asynchronous resolution of '%s', invalid resource record type '%d'\n",
+			name, rr_type);
 		return NULL;
 	} else if (rr_class > ns_c_max) {
-		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, resource record class '%d' exceeds maximum\n",
-			rr_class);
+		ast_log(LOG_ERROR, "Could not perform asynchronous resolution of '%s', resource record class '%d' exceeds maximum\n",
+			name, rr_class);
 		return NULL;
 	} else if (rr_class < 0) {
-		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, invalid resource class '%d'\n",
-			rr_class);
+		ast_log(LOG_ERROR, "Could not perform asynchronous resolution of '%s', invalid resource class '%d'\n",
+			name, rr_class);
 		return NULL;
 	} else if (!callback) {
-		ast_log(LOG_ERROR, "Could not perform asynchronous resolution, no callback provided\n");
+		ast_log(LOG_ERROR, "Could not perform asynchronous resolution of '%s', no callback provided\n",
+			name);
 		return NULL;
 	}
 
@@ -250,20 +251,24 @@
 		ast_log(LOG_ERROR, "Could not perform synchronous resolution, no name provided\n");
 		return -1;
 	} else if (rr_type > ns_t_max) {
-		ast_log(LOG_ERROR, "Could not perform synchronous resolution, resource record type '%d' exceeds maximum\n",
-			rr_type);
+		ast_log(LOG_ERROR, "Could not perform synchronous resolution of '%s', resource record type '%d' exceeds maximum\n",
+			name, rr_type);
 		return -1;
 	} else if (rr_type < 0) {
-		ast_log(LOG_ERROR, "Could not perform synchronous resolution, invalid resource record type '%d'\n",
-			rr_type);
+		ast_log(LOG_ERROR, "Could not perform synchronous resolution of '%s', invalid resource record type '%d'\n",
+			name, rr_type);
 		return -1;
 	} else if (rr_class > ns_c_max) {
-		ast_log(LOG_ERROR, "Could not perform synchronous resolution, resource record class '%d' exceeds maximum\n",
-			rr_class);
+		ast_log(LOG_ERROR, "Could not perform synchronous resolution of '%s', resource record class '%d' exceeds maximum\n",
+			name, rr_class);
 		return -1;
 	} else if (rr_class < 0) {
-		ast_log(LOG_ERROR, "Could not perform synchronous resolution, invalid resource class '%d'\n",
-			rr_class);
+		ast_log(LOG_ERROR, "Could not perform synchronous resolution of '%s', invalid resource class '%d'\n",
+			name, rr_class);
+		return -1;
+	} else if (!result) {
+		ast_log(LOG_ERROR, "Could not perform synchronous resolution of '%s', no result pointer provided for storing results\n",
+			name);
 		return -1;
 	}
 

Modified: team/group/dns/tests/test_dns.c
URL: http://svnview.digium.com/svn/asterisk/team/group/dns/tests/test_dns.c?view=diff&rev=432525&r1=432524&r2=432525
==============================================================================
--- team/group/dns/tests/test_dns.c (original)
+++ team/group/dns/tests/test_dns.c Fri Mar  6 12:35:10 2015
@@ -990,11 +990,11 @@
 
 	if (!ast_dns_resolve("asterisk.org", ns_t_a, ns_c_in, &result)) {
 		ast_test_status_update(test, "DNS resolution succeeded when we expected it not to\n");
-		ast_dns_resolver_unregister(&test_resolver);
-		return AST_TEST_FAIL;
-	}
-
-	ast_dns_resolver_unregister(&test_resolver);
+		ast_dns_resolver_unregister(&terrible_resolver);
+		return AST_TEST_FAIL;
+	}
+
+	ast_dns_resolver_unregister(&terrible_resolver);
 
 	if (result) {
 		ast_test_status_update(test, "Failed DNS resolution set the result to something non-NULL\n");




More information about the asterisk-commits mailing list