diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-20 07:52:07 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-20 07:52:07 +0000 |
commit | 2e9c1f139597dc485f1e45280cc6535f93b99c38 (patch) | |
tree | abf856ca86fa4aa46c993718d7ec0fe45ffacf9f /channels | |
parent | fbe3ce4dc5737285cf519f39896f7f5121e4db72 (diff) |
Stage 1 of deadlock fix (bug #1673 -- but not yet solved, just started) and fix configs ending with no newline (bug #1672)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3025 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0e28fd163..0aa8f57ec 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4538,8 +4538,17 @@ static int get_refer_info(struct sip_pvt *p, struct sip_request *oreq) p2 = iflist; while(p2) { if (!strcmp(p2->callid, tmp5)) { - /* Go ahead and lock it before returning */ + /* Go ahead and lock it (and its owner) before returning */ ast_mutex_lock(&p2->lock); + if (p2->owner) { + while(ast_mutex_trylock(&p2->owner->lock)) { + ast_mutex_unlock(&p2->lock); + usleep(1); + ast_mutex_lock(&p2->lock); + if (!p2->owner) + break; + } + } p->refer_call = p2; break; } @@ -6471,6 +6480,8 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc if (p->refer_call) { ast_log(LOG_DEBUG,"202 Accepted (supervised)\n"); attempt_transfer(p, p->refer_call); + if (p->refer_call->owner) + ast_mutex_unlock(&p->refer_call->owner->lock); ast_mutex_unlock(&p->refer_call->lock); p->refer_call = NULL; p->gotrefer = 1; |