aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_monitor.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-20 16:30:10 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-20 16:30:10 +0000
commitec76498f552e4ff10adcaa0ffc27d1c21cb5792e (patch)
treeefbb775d4f7e80cb61b314075217774d082e881a /res/res_monitor.c
parent7e42c962d89de0673789eed30649fc7ae276aa50 (diff)
Make ast_channel_walk become ast_channel_walk_locked
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3029 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_monitor.c')
-rwxr-xr-xres/res_monitor.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 22e365d08..3d7217090 100755
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -333,12 +333,13 @@ static int start_monitor_action(struct mansession *s, struct message *m)
astman_send_error(s, m, "No channel specified");
return 0;
}
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
while(c) {
if (!strcasecmp(c->name, name)) {
break;
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
if (!c) {
astman_send_error(s, m, "No such channel");
@@ -360,6 +361,7 @@ static int start_monitor_action(struct mansession *s, struct message *m)
return 0;
}
}
+ ast_mutex_unlock(&c->lock);
astman_send_ack(s, m, "Started monitoring channel");
return 0;
}
@@ -368,22 +370,26 @@ static int stop_monitor_action(struct mansession *s, struct message *m)
{
struct ast_channel *c = NULL;
char *name = astman_get_header(m, "Channel");
+ int res;
if((!name)||(!strlen(name))) {
astman_send_error(s, m, "No channel specified");
return 0;
}
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
while(c) {
if (!strcasecmp(c->name, name)) {
break;
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
if (!c) {
astman_send_error(s, m, "No such channel");
return 0;
}
- if( ast_monitor_stop( c, 1 ) ) {
+ res = ast_monitor_stop( c, 1 );
+ ast_mutex_unlock(&c->lock);
+ if( res ) {
astman_send_error(s, m, "Could not stop monitoring channel");
return 0;
}
@@ -404,12 +410,13 @@ static int change_monitor_action(struct mansession *s, struct message *m)
astman_send_error(s, m, "No filename specified");
return 0;
}
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
while(c) {
if (!strcasecmp(c->name, name)) {
break;
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
if (!c) {
astman_send_error(s, m, "No such channel");