[Asterisk-cvs] asterisk/channels chan_sip.c,1.173,1.174
markster at lists.digium.com
markster at lists.digium.com
Mon Sep 8 14:37:16 CDT 2003
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv31962/channels
Modified Files:
chan_sip.c
Log Message:
Fix "potential" deadlock and make not-a-deadlock
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -C2 -d -r1.173 -r1.174
*** chan_sip.c 8 Sep 2003 16:48:06 -0000 1.173
--- chan_sip.c 8 Sep 2003 19:38:24 -0000 1.174
***************
*** 422,453 ****
int res = 0;
ast_mutex_lock(&pkt->owner->lock);
! if (1 /* !p->owner->needdestroy */) {
! if (pkt->retrans < MAX_RETRANS) {
! pkt->retrans++;
! if (sipdebug) {
! if (pkt->owner->nat)
! ast_verbose("Retransmitting #%d (NAT):\n%s\n to %s:%d\n", pkt->retrans, pkt->data, inet_ntoa(pkt->owner->recv.sin_addr), ntohs(pkt->owner->recv.sin_port));
! else
! ast_verbose("Retransmitting #%d (no NAT):\n%s\n to %s:%d\n", pkt->retrans, pkt->data, inet_ntoa(pkt->owner->sa.sin_addr), ntohs(pkt->owner->sa.sin_port));
! }
! __sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
! res = 1;
! } else {
! ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s)\n", pkt->owner->callid, pkt->seqno, pkt->resp ? "Response" : "Request");
! pkt->retransid = -1;
! if (pkt->owner->owner) {
! /* XXX Potential deadlocK?? XXX */
! ast_queue_hangup(pkt->owner->owner, 1);
! } else {
! /* If no owner, destroy now */
! pkt->owner->needdestroy = 1;
! }
}
} else {
! /* Don't bother retransmitting. It's about to be killed anyway */
pkt->retransid = -1;
if (pkt->owner->owner) {
/* XXX Potential deadlocK?? XXX */
! ast_queue_hangup(pkt->owner->owner, 1);
} else {
/* If no owner, destroy now */
--- 422,447 ----
int res = 0;
ast_mutex_lock(&pkt->owner->lock);
! if (pkt->retrans < MAX_RETRANS) {
! pkt->retrans++;
! if (sipdebug) {
! if (pkt->owner->nat)
! ast_verbose("Retransmitting #%d (NAT):\n%s\n to %s:%d\n", pkt->retrans, pkt->data, inet_ntoa(pkt->owner->recv.sin_addr), ntohs(pkt->owner->recv.sin_port));
! else
! ast_verbose("Retransmitting #%d (no NAT):\n%s\n to %s:%d\n", pkt->retrans, pkt->data, inet_ntoa(pkt->owner->sa.sin_addr), ntohs(pkt->owner->sa.sin_port));
}
+ __sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
+ res = 1;
} else {
! ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s)\n", pkt->owner->callid, pkt->seqno, pkt->resp ? "Response" : "Request");
pkt->retransid = -1;
+ while(pkt->owner->owner && !ast_mutex_lock(&pkt->owner->owner->lock)) {
+ ast_mutex_unlock(&pkt->owner->lock);
+ usleep(1);
+ ast_mutex_lock(&pkt->owner->lock);
+ }
if (pkt->owner->owner) {
/* XXX Potential deadlocK?? XXX */
! ast_queue_hangup(pkt->owner->owner, 0);
! ast_mutex_unlock(&pkt->owner->owner->lock);
} else {
/* If no owner, destroy now */
More information about the svn-commits
mailing list