[asterisk-commits] mmichelson: trunk r257025 - /trunk/funcs/func_srv.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 13 11:15:42 CDT 2010


Author: mmichelson
Date: Tue Apr 13 11:15:36 2010
New Revision: 257025

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257025
Log:
Address Russell's comments on func_srv from reviewboard.
 
* Change copyright date
* Place channel in autoservice when doing SRV lookup
* Get rid of trailing whitespace
* Change logic in load_module function


Modified:
    trunk/funcs/func_srv.c

Modified: trunk/funcs/func_srv.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_srv.c?view=diff&rev=257025&r1=257024&r2=257025
==============================================================================
--- trunk/funcs/func_srv.c (original)
+++ trunk/funcs/func_srv.c Tue Apr 13 11:15:36 2010
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2006 Digium, Inc.
+ * Copyright (C) 1999 - 2010 Digium, Inc.
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -99,14 +99,17 @@
 		return NULL;
 	}
 
+	ast_autoservice_start(chan);
 	if (ast_srv_lookup(&srds->context, service, &host, &port) < 0) {
+		ast_autoservice_stop(chan);
 		ast_log(LOG_NOTICE, "Error performing lookup of service '%s'\n", service);
 		ast_free(srds);
 		return NULL;
 	}
+	ast_autoservice_stop(chan);
 
 	strcpy(srds->id, service);
-	
+
 	if (!(datastore = ast_datastore_alloc(&srv_result_datastore_info, srds->id))) {
 		ast_srv_cleanup(&srds->context);
 		ast_free(srds);
@@ -245,12 +248,16 @@
 
 static int load_module(void)
 {
-	int res = AST_MODULE_LOAD_SUCCESS;
-
-	res |= ast_custom_function_register(&srv_query_function);
-	res |= ast_custom_function_register(&srv_result_function);
-
-	return res;
+	int res = ast_custom_function_register(&srv_query_function);
+	if (res < 0) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+	res = ast_custom_function_register(&srv_result_function);
+	if (res < 0) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	return AST_MODULE_LOAD_SUCCESS;;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SRV related dialplan functions");




More information about the asterisk-commits mailing list