dect
/
asterisk
Archived
13
0
Fork 0

Fix potential race in check_availability

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1191 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
markster 2003-07-16 02:25:53 +00:00
parent 32efcd0acc
commit b312710014
1 changed files with 1 additions and 1 deletions

View File

@ -605,7 +605,7 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
continue;
}
ast_pthread_mutex_lock(&p->lock);
if (p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
ast_log(LOG_DEBUG, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
/* We found a pending call, time to merge */
chan = agent_new(newlyavailable, AST_STATE_DOWN);