diff options
author | Matthew Jordan <mjordan@digium.com> | 2014-03-16 20:27:28 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2014-03-16 20:27:28 +0000 |
commit | 2c5484c86996c07bdcf8b101519fc9467a052b15 (patch) | |
tree | 8476caeedad2aea9acb46992d0ada2d2ae6a3f77 | |
parent | a0a51a65e06c2e8b49fb5e42aec6f8b6d867d135 (diff) |
stasis/app.c: Add some extra debugging for subscription counts
Events are sent to a connected ARI application based on the things that ARI
application cares about. These subscriptions can be set up implicitly - such
as when that ARI application creates a new object - or explicitly, via the
application resource's subscription operations. Debugging *why* something was
being sent to an application - or why something was not being sent to an
application - was a bit tricky, as there was no debug information for the
subscriptions.
This patch adds some debug level 3 statements that show the subscription counts
for applications. (Level 3 was chosen as it matches the verbose level 3
statements elsewhere)
........
Merged revisions 410650 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/stasis/app.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c index dc322b6bf..54ee5898e 100644 --- a/res/stasis/app.c +++ b/res/stasis/app.c @@ -970,6 +970,7 @@ int app_subscribe_channel(struct stasis_app *app, struct ast_channel *chan) } ++forwards->interested; + ast_debug(3, "Channel '%s' is %d interested in %s\n", ast_channel_uniqueid(chan), forwards->interested, app->name); return 0; } } @@ -991,9 +992,12 @@ static int unsubscribe(struct stasis_app *app, const char *kind, const char *id) app->name, kind, id); return -1; } + forwards->interested--; - if (--forwards->interested == 0) { + ast_debug(3, "%s '%s': is %d interested in %s\n", kind, id, forwards->interested, app->name); + if (forwards->interested == 0) { /* No one is interested any more; unsubscribe */ + ast_debug(3, "%s '%s' unsubscribed from %s\n", kind, id, app->name); forwards_unsubscribe(forwards); ao2_find(app->forwards, forwards, OBJ_POINTER | OBJ_NOLOCK | OBJ_UNLINK | @@ -1062,6 +1066,7 @@ int app_subscribe_bridge(struct stasis_app *app, struct ast_bridge *bridge) } ++forwards->interested; + ast_debug(3, "Bridge '%s' is %d interested in %s\n", bridge->uniqueid, forwards->interested, app->name); return 0; } } @@ -1130,6 +1135,7 @@ int app_subscribe_endpoint(struct stasis_app *app, struct ast_endpoint *endpoint } ++forwards->interested; + ast_debug(3, "Endpoint '%s' is %d interested in %s\n", ast_endpoint_get_id(endpoint), forwards->interested, app->name); return 0; } } |