diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-10 13:04:42 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-10 13:04:42 +0000 |
commit | 3db7383b42043a5bfb84d7d7a6741eaa0452c22c (patch) | |
tree | ffb3ca49f464c594d74438e66f81b97a7aabb2bb /channels | |
parent | dd9ed7bb082d03c4f006116f468aaa0bb07df53b (diff) |
Rip out half implementation of 491 response support, since it wasn't implemented
properly and caused memory leaks in the case of us getting 491's, which Asterisk
actually sends...
Since it is a bit too complicated to fix this, I'll rip it out of 1.4 and put
it on the to-do-list for future releases. Now, we handle this as congestion,
which it really is.
Issue #8331
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47418 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b2c4c77c0..f207d4c26 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1238,7 +1238,7 @@ static void sip_scheddestroy(struct sip_pvt *p, int ms); static void sip_cancel_destroy(struct sip_pvt *p); static void sip_destroy(struct sip_pvt *p); static void __sip_destroy(struct sip_pvt *p, int lockowner); -static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int reset); +static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); static void __sip_pretend_ack(struct sip_pvt *p); static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); static int auto_congest(void *nothing); @@ -2005,7 +2005,7 @@ static void sip_cancel_destroy(struct sip_pvt *p) } /*! \brief Acknowledges receipt of a packet and stops retransmission */ -static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int reset) +static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod) { struct sip_pkt *cur, *prev = NULL; @@ -2033,8 +2033,7 @@ static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid); ast_sched_del(sched, cur->retransid); } - if (!reset) - free(cur); + free(cur); break; } } @@ -2057,7 +2056,7 @@ static void __sip_pretend_ack(struct sip_pvt *p) } cur = p->packets; method = (cur->method) ? cur->method : find_sip_method(cur->data); - __sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method, FALSE); + __sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method); } } @@ -11613,9 +11612,13 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru break; case 491: /* Pending */ - /* we have to wait a while, then retransmit */ - /* Transmission is rescheduled, so everything should be taken care of. - We should support the retry-after at some point */ + /* we really should have to wait a while, then retransmit */ + /* We should support the retry-after at some point */ + /* At this point, we treat this as a congestion */ + transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE); + if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE)) + ast_queue_control(p->owner, AST_CONTROL_CONGESTION); + ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); break; case 501: /* Not implemented */ @@ -11887,7 +11890,7 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ if ((resp >= 100) && (resp <= 199)) __sip_semi_ack(p, seqno, 0, sipmethod); else - __sip_ack(p, seqno, 0, sipmethod, resp == 491 ? TRUE : FALSE); + __sip_ack(p, seqno, 0, sipmethod); /* Get their tag if we haven't already */ if (ast_strlen_zero(p->theirtag) || (resp >= 200)) { @@ -14379,7 +14382,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc /* Make sure we don't ignore this */ if (seqno == p->pendinginvite) { p->pendinginvite = 0; - __sip_ack(p, seqno, FLAG_RESPONSE, 0, FALSE); + __sip_ack(p, seqno, FLAG_RESPONSE, 0); if (find_sdp(req)) { if (process_sdp(p, req)) return -1; |