aboutsummaryrefslogtreecommitdiffstats
path: root/manager.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 /manager.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 'manager.c')
-rwxr-xr-xmanager.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/manager.c b/manager.c
index ed94d80ce..53dcf6f09 100755
--- a/manager.c
+++ b/manager.c
@@ -376,18 +376,20 @@ static int action_hangup(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");
return 0;
}
ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
+ ast_mutex_unlock(&c->lock);
astman_send_ack(s, m, "Channel Hungup");
return 0;
}
@@ -399,7 +401,7 @@ static int action_status(struct mansession *s, struct message *m)
struct ast_channel *c;
char bridge[256];
astman_send_ack(s, m, "Channel status will follow");
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
if (id && strlen(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
while(c) {
@@ -436,7 +438,8 @@ static int action_status(struct mansession *s, struct message *m)
c->name, c->callerid ? c->callerid : "<unknown>",
ast_state2str(c->_state), bridge, c->uniqueid, idText);
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
ast_cli(s->fd,
"Event: StatusComplete\r\n"
@@ -688,18 +691,20 @@ static int action_timeout(struct mansession *s, struct message *m)
astman_send_error(s, m, "No timeout 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;
}
ast_channel_setwhentohangup(c, timeout);
+ ast_mutex_unlock(&c->lock);
astman_send_ack(s, m, "Timeout Set");
return 0;
}