[Asterisk-code-review] main/stasis.c: Added detail info for stasis show app cli (...asterisk[master])
sungtae kim
asteriskteam at digium.com
Tue Apr 9 19:10:08 CDT 2019
sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11253
Change subject: main/stasis.c: Added detail info for stasis show app cli
......................................................................
main/stasis.c: Added detail info for stasis show app cli
Currently, the "stasis show app" cli doesn't give detail
of subscription/subscriber information.
Added more printings to show details.
ASTERISK-28378
Change-Id: If25a6f14fe4f622bfb37462e891333da1fdf875f
---
M main/stasis.c
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/53/11253/1
diff --git a/main/stasis.c b/main/stasis.c
index 4ce7052..fcc17b1 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -2369,6 +2369,7 @@
{
struct stasis_topic *topic;
char print_time[32];
+ int i;
switch (cmd) {
case CLI_INIT:
@@ -2402,6 +2403,20 @@
ast_format_duration_hh_mm_ss(ast_tvnow().tv_sec - topic->creationtime->tv_sec, print_time, sizeof(print_time));
ast_cli(a->fd, "Duration time: %s\n", print_time);
+ ao2_lock(topic);
+ ast_cli(a->fd, "\nSubscribers:\n");
+ for (i = 0; i < AST_VECTOR_SIZE(&topic->subscribers); i++) {
+ struct stasis_subscription *subscription_tmp = AST_VECTOR_GET(&topic->subscribers, i);
+ ast_cli(a->fd, " %s: %d: %s\n", subscription_tmp->uniqueid, subscription_tmp->topic->subscriber_id, subscription_tmp->topic->name);
+ }
+
+ ast_cli(a->fd, "\nSubscriptions:\n");
+ for (i = 0; i < AST_VECTOR_SIZE(&topic->upstream_topics); i++) {
+ struct stasis_topic *topic_tmp = AST_VECTOR_GET(&topic->upstream_topics, i);
+ ast_cli(a->fd, " %d: %s\n", topic_tmp->subscriber_id, topic_tmp->name);
+ }
+ ao2_unlock(topic);
+
ao2_ref(topic, -1);
return CLI_SUCCESS;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11253
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If25a6f14fe4f622bfb37462e891333da1fdf875f
Gerrit-Change-Number: 11253
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190409/a9fd77eb/attachment.html>
More information about the asterisk-code-review
mailing list