[asterisk-commits] kmoore: branch kmoore/res_sip_threadpool_options r396150 - /team/kmoore/res_s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 2 13:24:30 CDT 2013


Author: kmoore
Date: Fri Aug  2 13:24:29 2013
New Revision: 396150

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396150
Log:
Remove secondary setting of defaults

Modified:
    team/kmoore/res_sip_threadpool_options/res/res_pjsip/config_system.c

Modified: team/kmoore/res_sip_threadpool_options/res/res_pjsip/config_system.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/res_sip_threadpool_options/res/res_pjsip/config_system.c?view=diff&rev=396150&r1=396149&r2=396150
==============================================================================
--- team/kmoore/res_sip_threadpool_options/res/res_pjsip/config_system.c (original)
+++ team/kmoore/res_sip_threadpool_options/res/res_pjsip/config_system.c Fri Aug  2 13:24:29 2013
@@ -52,10 +52,6 @@
 
 static struct ast_threadpool_options sip_threadpool_options = {
 	.version = AST_THREADPOOL_OPTIONS_VERSION,
-	.initial_size = 0,
-	.auto_increment = 5,
-	.idle_timeout = 60,
-	.max_size = 0,
 };
 
 void sip_get_threadpool_options(struct ast_threadpool_options *threadpool_options)
@@ -111,6 +107,9 @@
 
 int ast_sip_initialize_system(void)
 {
+	RAII_VAR(struct ao2_container *, system_configs, NULL, ao2_cleanup);
+	RAII_VAR(struct system_config *, system, NULL, ao2_cleanup);
+
 	system_sorcery = ast_sorcery_open();
 	if (!system_sorcery) {
 		ast_log(LOG_ERROR, "Failed to open SIP system sorcery\n");
@@ -145,5 +144,24 @@
 
 	ast_sorcery_load(system_sorcery);
 
+	system_configs = ast_sorcery_retrieve_by_fields(system_sorcery, "system",
+		AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
+
+	if (ao2_container_count(system_configs)) {
+		return 0;
+	}
+
+	/* No config present, allocate one and apply defaults */
+	system = ast_sorcery_alloc(system_sorcery, "system", NULL);
+	if (!system) {
+		ast_log(LOG_ERROR, "Unable to allocate default system config.\n");
+		return -1;
+	}
+
+	if (system_apply(system_sorcery, system)) {
+		ast_log(LOG_ERROR, "Failed to apply default system config.\n");
+		return -1;
+	}
+
 	return 0;
 }




More information about the asterisk-commits mailing list