[asterisk-commits] russell: branch russell/chan_refcount r82354 - /team/russell/chan_refcount/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 13 17:04:07 CDT 2007
Author: russell
Date: Thu Sep 13 17:04:07 2007
New Revision: 82354
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82354
Log:
convert handler for core set debug channel CLI command
Modified:
team/russell/chan_refcount/main/cli.c
Modified: team/russell/chan_refcount/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/cli.c?view=diff&rev=82354&r1=82353&r2=82354
==============================================================================
--- team/russell/chan_refcount/main/cli.c (original)
+++ team/russell/chan_refcount/main/cli.c Thu Sep 13 17:04:07 2007
@@ -805,6 +805,7 @@
{
struct ast_channel *c = NULL;
int is_all, is_off = 0;
+ struct ast_channel_iterator *iter = NULL;
switch (cmd) {
case CLI_INIT:
@@ -838,13 +839,16 @@
global_fin |= DEBUGCHAN_FLAG;
global_fout |= DEBUGCHAN_FLAG;
}
- c = ast_channel_walk_locked(NULL);
+ iter = ast_channel_iterator_all_new();
+ if (iter)
+ c = ast_channel_iterator_next(iter);
} else {
- c = ast_get_channel_by_name_locked(a->argv[e->args]);
- if (c == NULL)
+ if (!(c = ast_channel_get_by_name(a->argv[e->args])))
ast_cli(a->fd, "No such channel %s\n", a->argv[e->args]);
}
+
while (c) {
+ ast_channel_lock(c);
if (!(c->fin & DEBUGCHAN_FLAG) || !(c->fout & DEBUGCHAN_FLAG)) {
if (is_off) {
c->fin &= ~DEBUGCHAN_FLAG;
@@ -856,11 +860,17 @@
ast_cli(a->fd, "Debugging %s on channel %s\n", is_off ? "disabled" : "enabled", c->name);
}
ast_channel_unlock(c);
+ ast_channel_unref(c);
if (!is_all)
break;
- c = ast_channel_walk_locked(c);
- }
+ c = ast_channel_iterator_next(iter);
+ }
+
+ if (iter)
+ ast_channel_iterator_destroy(iter);
+
ast_cli(a->fd, "Debugging on new channels is %s\n", is_off ? "disabled" : "enabled");
+
return RESULT_SUCCESS;
}
More information about the asterisk-commits
mailing list