aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-05 12:52:50 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-05 12:52:50 +0000
commit21e40c48cf98634a8d74ea5d8b175c6133490e1b (patch)
tree93d239fc6ce8303e164dd75048460b839665c751
parent47042ec26b98527da64f194ddbd33ea8189c1cfe (diff)
Only unlock our pvt and net locks if we are actually going to try to lock the owner again. (issue #9472 reported by zoa)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@60213 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9e11e0275..fae574002 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11496,17 +11496,20 @@ retrylock:
/* Go ahead and lock the owner if it has one -- we may need it */
if (p->owner && ast_mutex_trylock(&p->owner->lock)) {
ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
- ast_mutex_unlock(&p->lock);
- ast_mutex_unlock(&netlock);
- /* Sleep for a very short amount of time */
- usleep(1);
- if (--lockretry)
+ if (--lockretry) {
+ ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&netlock);
+ usleep(1);
goto retrylock;
+ }
}
if (!lockretry) {
- ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid);
+ if (p->owner)
+ ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid);
ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");
+ ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&netlock);
return 1;
}
memcpy(&p->recv, &sin, sizeof(p->recv));