[asterisk-commits] file: branch group/stasis_cache_usage r392844 - /team/group/stasis_cache_usag...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 25 08:50:41 CDT 2013


Author: file
Date: Tue Jun 25 08:50:38 2013
New Revision: 392844

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392844
Log:
Handle some error cases.

Modified:
    team/group/stasis_cache_usage/main/bridging.c
    team/group/stasis_cache_usage/main/cli.c
    team/group/stasis_cache_usage/main/manager.c

Modified: team/group/stasis_cache_usage/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/bridging.c?view=diff&rev=392844&r1=392843&r2=392844
==============================================================================
--- team/group/stasis_cache_usage/main/bridging.c (original)
+++ team/group/stasis_cache_usage/main/bridging.c Tue Jun 25 08:50:38 2013
@@ -6475,7 +6475,9 @@
 	struct ao2_iterator iter;
 	struct stasis_message *msg;
 
-	cached_bridges = stasis_cache_dump(ast_bridge_topic_all_cached(), ast_bridge_snapshot_type());
+	if (!(cached_bridges = stasis_cache_dump(ast_bridge_topic_all_cached(), ast_bridge_snapshot_type()))) {
+		return NULL;
+	}
 
 	iter = ao2_iterator_init(cached_bridges, 0);
 	for (; (msg = ao2_iterator_next(&iter)); ao2_ref(msg, -1)) {
@@ -6511,9 +6513,13 @@
 		return NULL;
 	}
 
-	cached_bridges = stasis_cache_dump(ast_bridge_topic_all_cached(), ast_bridge_snapshot_type());
+	if (!(cached_bridges = stasis_cache_dump(ast_bridge_topic_all_cached(), ast_bridge_snapshot_type()))) {
+		ast_cli(a->fd, "Failed to retrieve cached bridges\n");
+		return CLI_SUCCESS;
+	}
 
 	ast_cli(a->fd, FORMAT_HDR, "Bridge-ID", "Chans", "Type", "Technology");
+
 	iter = ao2_iterator_init(cached_bridges, 0);
 	for (; (msg = ao2_iterator_next(&iter)); ao2_ref(msg, -1)) {
 		struct ast_bridge_snapshot *snapshot = stasis_message_data(msg);

Modified: team/group/stasis_cache_usage/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/cli.c?view=diff&rev=392844&r1=392843&r2=392844
==============================================================================
--- team/group/stasis_cache_usage/main/cli.c (original)
+++ team/group/stasis_cache_usage/main/cli.c Tue Jun 25 08:50:38 2013
@@ -914,7 +914,11 @@
 	} else if (a->argc != e->args - 1)
 		return CLI_SHOWUSAGE;
 
-	channels = stasis_cache_dump(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type());
+
+	if (!(channels = stasis_cache_dump(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type()))) {
+		ast_cli(a->fd, "Failed to retrieve cached channels\n");
+		return CLI_SUCCESS;
+	}
 
 	if (!count) {
 		if (!concise && !verbose)
@@ -1563,7 +1567,9 @@
 		return NULL;
 	}
 
-	cached_channels = stasis_cache_dump(ast_channel_topic_all_cached(), ast_channel_snapshot_type());
+	if (!(cached_channels = stasis_cache_dump(ast_channel_topic_all_cached(), ast_channel_snapshot_type()))) {
+		return NULL;
+	}
 
 	iter = ao2_iterator_init(cached_channels, 0);
 	for (; (msg = ao2_iterator_next(&iter)); ao2_ref(msg, -1)) {

Modified: team/group/stasis_cache_usage/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/manager.c?view=diff&rev=392844&r1=392843&r2=392844
==============================================================================
--- team/group/stasis_cache_usage/main/manager.c (original)
+++ team/group/stasis_cache_usage/main/manager.c Tue Jun 25 08:50:38 2013
@@ -5216,7 +5216,10 @@
 		idText[0] = '\0';
 	}
 
-	channels = stasis_cache_dump(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type());
+	if (!(channels = stasis_cache_dump(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type()))) {
+		astman_send_error(s, m, "Could not get cached channels");
+		return 0;
+	}
 
 	astman_send_listack(s, m, "Channels will follow", "start");
 




More information about the asterisk-commits mailing list