dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 241227 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r241227 | jpeeler | 2010-01-19 11:22:18 -0600 (Tue, 19 Jan 2010) | 13 lines
  
  Fix deadlock in agent_read by removing call to agent_logoff.
  
  One must always lock the agents list lock before the agent private. agent_read
  locks the private immediately, so locking the agents list lock is not an
  option (which is what agent_logoff requires). Because agent_read already 
  has access to the agent private all that is necessary is to do the required
  hanging up that agent_logoff performed.
  
  (closes issue #16321)
  Reported by: valon24
  Patches: 
        bug16321.patch uploaded by jpeeler (license 325)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@241314 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
jpeeler 2010-01-19 18:46:11 +00:00
parent 3d6ab2e41c
commit 665b780994
1 changed files with 19 additions and 1 deletions

View File

@ -562,7 +562,25 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
int howlong = cur_time - p->start;
if (p->autologoff && (howlong >= p->autologoff)) {
ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
agent_logoff(p->agent, 0);
if (p->owner || p->chan) {
while (p->owner && ast_channel_trylock(p->owner)) {
DEADLOCK_AVOIDANCE(&p->lock);
}
if (p->owner) {
ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
ast_channel_unlock(p->owner);
}
while (p->chan && ast_channel_trylock(p->chan)) {
DEADLOCK_AVOIDANCE(&p->lock);
}
if (p->chan) {
ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
ast_channel_unlock(p->chan);
}
} else {
p->deferlogoff = 1;
}
}
}
switch (f->frametype) {