summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2010-04-13 16:15:36 +0000
committerMark Michelson <mmichelson@digium.com>2010-04-13 16:15:36 +0000
commitfb0a4e5bd05c2eb05825d733f2d3fc32cc74afa4 (patch)
tree7cb6857108b9f9ebf3aa9d339a8374f0bcbb9a53 /funcs
parent69c252c290747cb18c767249c448112a40b4fe76 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257025 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_srv.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/funcs/func_srv.c b/funcs/func_srv.c
index 9715a276c..dc936c07a 100644
--- a/funcs/func_srv.c
+++ b/funcs/func_srv.c
@@ -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 @@ static struct srv_context *srv_datastore_setup(const char *service, struct ast_c
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 unload_module(void)
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);
+ 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 res;
+ return AST_MODULE_LOAD_SUCCESS;;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SRV related dialplan functions");