mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 12:25:35 +00:00
Merged revisions 211113 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r211113 | russell | 2009-08-07 15:12:21 -0500 (Fri, 07 Aug 2009) | 11 lines Recorded merge of revisions 211112 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r211112 | russell | 2009-08-07 15:11:31 -0500 (Fri, 07 Aug 2009) | 4 lines Resolve a deadlock involving app_chanspy and masquerades. (ABE-1936) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@211114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -455,17 +455,20 @@ static const struct ast_datastore_info chanspy_ds_info = {
|
|||||||
|
|
||||||
static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds)
|
static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds)
|
||||||
{
|
{
|
||||||
if (!chanspy_ds)
|
struct ast_channel *chan;
|
||||||
|
|
||||||
|
if (!chanspy_ds) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ast_mutex_lock(&chanspy_ds->lock);
|
ast_mutex_lock(&chanspy_ds->lock);
|
||||||
if (chanspy_ds->chan) {
|
while ((chan = chanspy_ds->chan)) {
|
||||||
struct ast_datastore *datastore;
|
struct ast_datastore *datastore;
|
||||||
struct ast_channel *chan;
|
|
||||||
|
|
||||||
chan = chanspy_ds->chan;
|
if (ast_channel_trylock(chan)) {
|
||||||
|
DEADLOCK_AVOIDANCE(&chanspy_ds->lock);
|
||||||
ast_channel_lock(chan);
|
continue;
|
||||||
|
}
|
||||||
if ((datastore = ast_channel_datastore_find(chan, &chanspy_ds_info, chanspy_ds->unique_id))) {
|
if ((datastore = ast_channel_datastore_find(chan, &chanspy_ds_info, chanspy_ds->unique_id))) {
|
||||||
ast_channel_datastore_remove(chan, datastore);
|
ast_channel_datastore_remove(chan, datastore);
|
||||||
/* chanspy_ds->chan is NULL after this call */
|
/* chanspy_ds->chan is NULL after this call */
|
||||||
@@ -474,6 +477,7 @@ static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds)
|
|||||||
ast_channel_datastore_free(datastore);
|
ast_channel_datastore_free(datastore);
|
||||||
}
|
}
|
||||||
ast_channel_unlock(chan);
|
ast_channel_unlock(chan);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&chanspy_ds->lock);
|
ast_mutex_unlock(&chanspy_ds->lock);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user