Skip to content
Snippets Groups Projects
Commit d488a8c5 authored by Mark Spencer's avatar Mark Spencer
Browse files

Be sure we have the agent lock

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1478 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent d4c55fbd
Branches
Tags
No related merge requests found
...@@ -1213,6 +1213,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) ...@@ -1213,6 +1213,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
if (res) if (res)
break; break;
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock); ast_mutex_lock(&p->lock);
if (p->lastdisc.tv_sec) { if (p->lastdisc.tv_sec) {
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
...@@ -1227,6 +1228,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) ...@@ -1227,6 +1228,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
} }
} }
ast_mutex_unlock(&p->lock); ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
/* Synchronize channel ownership between call to agent and itself. */ /* Synchronize channel ownership between call to agent and itself. */
ast_mutex_lock( &p->app_lock ); ast_mutex_lock( &p->app_lock );
ast_mutex_lock(&p->lock); ast_mutex_lock(&p->lock);
...@@ -1239,9 +1241,11 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) ...@@ -1239,9 +1241,11 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
agent_cont_sleep, p ); agent_cont_sleep, p );
ast_mutex_unlock( &p->app_lock ); ast_mutex_unlock( &p->app_lock );
if ((p->ackcall > 1) && (res == 1)) { if ((p->ackcall > 1) && (res == 1)) {
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock); ast_mutex_lock(&p->lock);
check_availability(p, 0); check_availability(p, 0);
ast_mutex_unlock(&p->lock); ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
res = 0; res = 0;
} }
sched_yield(); sched_yield();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment