diff options
author | Mark Spencer <markster@digium.com> | 2003-04-08 13:50:04 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2003-04-08 13:50:04 +0000 |
commit | 9cc2aa39d0f6f523818482ebb6668a219810aa22 (patch) | |
tree | 5420b3c52364b21c30fa55afd5f24e8d5f6e7493 /channels | |
parent | 4952835d93e7a42bd4a9f02fd1927c52bea9c41e (diff) |
Unlink local channels
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_local.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index feabb36ba..c8d4371e7 100755 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -220,6 +220,7 @@ static int local_hangup(struct ast_channel *ast) struct local_pvt *p = ast->pvt->pvt; int isoutbound = IS_OUTBOUND(ast, p); struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; + struct local_pvt *cur, *prev=NULL; ast_pthread_mutex_lock(&p->lock); if (isoutbound) p->chan = NULL; @@ -229,6 +230,22 @@ static int local_hangup(struct ast_channel *ast) if (!p->owner && !p->chan) { /* Okay, done with the private part now, too. */ ast_pthread_mutex_unlock(&p->lock); + /* Remove from list */ + ast_pthread_mutex_lock(&locallock); + cur = locals; + while(cur) { + if (cur == p) { + if (prev) + prev->next == cur->next; + else + locals = cur->next; + break; + } + prev = cur; + cur = cur->next; + } + ast_pthread_mutex_unlock(&locallock); + /* And destroy */ free(p); return 0; } |