[asterisk-commits] dlee: branch group/performance r399886 - /team/group/performance/main/manager.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 26 09:28:31 CDT 2013
Author: dlee
Date: Thu Sep 26 09:28:29 2013
New Revision: 399886
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399886
Log:
Only subscribe to AMI if we need it
Modified:
team/group/performance/main/manager.c
Modified: team/group/performance/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/manager.c?view=diff&rev=399886&r1=399885&r2=399886
==============================================================================
--- team/group/performance/main/manager.c (original)
+++ team/group/performance/main/manager.c Thu Sep 26 09:28:29 2013
@@ -1106,6 +1106,7 @@
static int httptimeout = 60;
static int broken_events_action = 0;
static int manager_enabled = 0;
+static int subscribed = 0;
static int webmanager_enabled = 0;
static int manager_debug = 0; /*!< enable some debugging code in the manager */
static int authtimeout;
@@ -7790,16 +7791,8 @@
*/
static int manager_subscriptions_init(void)
{
- int res;
-
- res = STASIS_MESSAGE_TYPE_INIT(ast_manager_get_generic_type);
- if (res != 0) {
- return -1;
- }
- manager_topic = stasis_topic_create("manager_topic");
- if (!manager_topic) {
- return -1;
- }
+ int res = 0;
+
rtp_topic_forwarder = stasis_forward_all(ast_rtp_topic(), manager_topic);
if (!rtp_topic_forwarder) {
return -1;
@@ -7819,6 +7812,36 @@
if (res != 0) {
return -1;
}
+ return 0;
+}
+
+static int subscribe_all(void)
+{
+ if (manager_subscriptions_init()) {
+ ast_log(AST_LOG_ERROR, "Failed to initialize manager subscriptions\n");
+ return -1;
+ }
+ if (manager_system_init()) {
+ ast_log(AST_LOG_ERROR, "Failed to initialize manager system handling\n");
+ return -1;
+ }
+ if (manager_channels_init()) {
+ ast_log(AST_LOG_ERROR, "Failed to initialize manager channel handling\n");
+ return -1;
+ }
+ if (manager_mwi_init()) {
+ ast_log(AST_LOG_ERROR, "Failed to initialize manager MWI handling\n");
+ return -1;
+ }
+ if (manager_bridging_init()) {
+ return -1;
+ }
+ if (manager_endpoints_init()) {
+ ast_log(AST_LOG_ERROR, "Failed to initialize manager endpoints handling\n");
+ return -1;
+ }
+
+ subscribed = 1;
return 0;
}
@@ -7844,27 +7867,12 @@
manager_enabled = 0;
if (!reload) {
- if (manager_subscriptions_init()) {
- ast_log(AST_LOG_ERROR, "Failed to initialize manager subscriptions\n");
+ int res = STASIS_MESSAGE_TYPE_INIT(ast_manager_get_generic_type);
+ if (res != 0) {
return -1;
}
- if (manager_system_init()) {
- ast_log(AST_LOG_ERROR, "Failed to initialize manager system handling\n");
- return -1;
- }
- if (manager_channels_init()) {
- ast_log(AST_LOG_ERROR, "Failed to initialize manager channel handling\n");
- return -1;
- }
- if (manager_mwi_init()) {
- ast_log(AST_LOG_ERROR, "Failed to initialize manager MWI handling\n");
- return -1;
- }
- if (manager_bridging_init()) {
- return -1;
- }
- if (manager_endpoints_init()) {
- ast_log(AST_LOG_ERROR, "Failed to initialize manager endpoints handling\n");
+ manager_topic = stasis_topic_create("manager_topic");
+ if (!manager_topic) {
return -1;
}
}
@@ -8052,6 +8060,13 @@
}
}
+ if (manager_enabled && !subscribed) {
+ if (subscribe_all() != 0) {
+ ast_log(LOG_ERROR, "Manager subscription error\n");
+ return -1;
+ }
+ }
+
ast_sockaddr_copy(&amis_desc_local_address_tmp, &amis_desc.local_address);
/* if the amis address has not been set, default is the same as non secure ami */
More information about the asterisk-commits
mailing list