mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Fix agent deadlock
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -539,7 +539,6 @@ static int agent_cont_sleep( void *data )
|
|||||||
static int agent_ack_sleep( void *data )
|
static int agent_ack_sleep( void *data )
|
||||||
{
|
{
|
||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
struct timeval tv;
|
|
||||||
int res;
|
int res;
|
||||||
int to = 1000;
|
int to = 1000;
|
||||||
|
|
||||||
@@ -814,7 +813,7 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
|
|||||||
static int check_beep(struct agent_pvt *newlyavailable, int needlock)
|
static int check_beep(struct agent_pvt *newlyavailable, int needlock)
|
||||||
{
|
{
|
||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
int res;
|
int res=0;
|
||||||
ast_log(LOG_DEBUG, "Checking beep availability of '%s'\n", newlyavailable->agent);
|
ast_log(LOG_DEBUG, "Checking beep availability of '%s'\n", newlyavailable->agent);
|
||||||
if (needlock)
|
if (needlock)
|
||||||
ast_mutex_lock(&agentlock);
|
ast_mutex_lock(&agentlock);
|
||||||
@@ -836,6 +835,7 @@ static int check_beep(struct agent_pvt *newlyavailable, int needlock)
|
|||||||
if (needlock)
|
if (needlock)
|
||||||
ast_mutex_unlock(&agentlock);
|
ast_mutex_unlock(&agentlock);
|
||||||
if (p) {
|
if (p) {
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
ast_log( LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language);
|
ast_log( LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language);
|
||||||
res = ast_streamfile(newlyavailable->chan, "beep", newlyavailable->chan->language);
|
res = ast_streamfile(newlyavailable->chan, "beep", newlyavailable->chan->language);
|
||||||
ast_log( LOG_DEBUG, "Played beep, result '%d'\n", res);
|
ast_log( LOG_DEBUG, "Played beep, result '%d'\n", res);
|
||||||
@@ -843,6 +843,7 @@ static int check_beep(struct agent_pvt *newlyavailable, int needlock)
|
|||||||
res = ast_waitstream(newlyavailable->chan, "");
|
res = ast_waitstream(newlyavailable->chan, "");
|
||||||
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
|
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
|
||||||
}
|
}
|
||||||
|
ast_mutex_lock(&p->lock);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user