[asterisk-commits] rizzo: branch rizzo/astobj2 r47499 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Nov 12 06:40:57 MST 2006
Author: rizzo
Date: Sun Nov 12 07:40:55 2006
New Revision: 47499
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47499
Log:
following suggestion by olle, in __sip_ack() can match
directly on the method, without doing an expensive strcmp().
on passing, look at the error message which probably had the
Found/Not Found string reversed.
two more reasons to make this a trunk candidate.
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47499&r1=47498&r2=47499
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sun Nov 12 07:40:55 2006
@@ -2146,19 +2146,15 @@
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur, *prev = NULL;
-
- /* Just in case... */
- int res = FALSE;
- char *msg = sip_methods[sipmethod].text;
- int len = strlen(msg);
+ 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)
continue;
/* XXX need to tokenize packets, rather than doing a stcasecmp */
- if ((ast_test_flag(cur, FLAG_RESPONSE) || (!strncasecmp(msg, cur->data, len) && cur->data[len] < 33))) {
- res = TRUE; /* this is our packet */
+ 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);
@@ -2177,7 +2173,8 @@
}
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