[asterisk-commits] rizzo: trunk r47538 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Nov 13 07:14:54 MST 2006
Author: rizzo
Date: Mon Nov 13 08:14:54 2006
New Revision: 47538
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47538
Log:
merge from codename-pineapple and astobj2 47499:
simplify __sip_ack() removing a strcmp for looking up packets.
no functional change, only performance, so don't need to merging
to earlier branches now.
Approved By: oej
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=47538&r1=47537&r2=47538
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Nov 13 08:14:54 2006
@@ -2062,38 +2062,33 @@
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur, *prev = NULL;
-
- /* Just in case... */
- char *msg;
- int res = FALSE;
-
- msg = sip_methods[sipmethod].text;
+ const char *msg = "Not Found"; /* used only for debugging */
sip_pvt_lock(p);
for (cur = p->packets; cur; prev = cur, cur = cur->next) {
- if ((cur->seqno == seqno) && ((ast_test_flag(cur, FLAG_RESPONSE)) == resp) &&
- ((ast_test_flag(cur, FLAG_RESPONSE)) ||
- (!strncasecmp(msg, cur->data, strlen(msg)) && (cur->data[strlen(msg)] < 33)))) {
+ if (cur->seqno != seqno || ast_test_flag(cur, FLAG_RESPONSE) != resp)
+ continue;
+ if (ast_test_flag(cur, FLAG_RESPONSE) || cur->method == sipmethod) {
+ msg = "Found";
if (!resp && (seqno == p->pendinginvite)) {
if (option_debug)
ast_log(LOG_DEBUG, "Acked pending invite %d\n", p->pendinginvite);
p->pendinginvite = 0;
}
- /* this is our baby */
- res = TRUE;
- UNLINK(cur, p->packets, prev);
if (cur->retransid > -1) {
if (sipdebug && option_debug > 3)
ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
ast_sched_del(sched, cur->retransid);
}
+ UNLINK(cur, p->packets, prev);
free(cur);
break;
}
}
sip_pvt_unlock(p);
if (option_debug)
- ast_log(LOG_DEBUG, "Stopping retransmission on '%s' of %s %d: Match %s\n", p->callid, resp ? "Response" : "Request", seqno, res ? "Not Found" : "Found");
+ ast_log(LOG_DEBUG, "Stopping retransmission on '%s' of %s %d: Match %s\n",
+ p->callid, resp ? "Response" : "Request", seqno, msg);
}
/*! \brief Pretend to ack all packets
More information about the asterisk-commits
mailing list