summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-05-11 09:24:35 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-05-11 09:24:35 +0000
commit067c472abbe4963f0667ce82a0bd786e478d12e3 (patch)
tree551b3603101a82d32c5fbd3530511ec52e96aaf5 /channels
parent0cc5a883507ed0459de1dd7cc86b578e419a8de9 (diff)
simplify sip_pretend_ack also removing a bug in the existing
code which called ast_skip_blanks erroneously. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 154147c64..c87e9d013 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1738,27 +1738,20 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int
}
/*! \brief Pretend to ack all packets */
+/* maybe the lock on p is not strictly necessary but there might be a race */
static int __sip_pretend_ack(struct sip_pvt *p)
{
struct sip_pkt *cur = NULL;
while (p->packets) {
+ int method;
if (cur == p->packets) {
ast_log(LOG_WARNING, "Have a packet that doesn't want to give up! %s\n", sip_methods[cur->method].text);
return -1;
}
cur = p->packets;
- if (cur->method)
- __sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), cur->method, FALSE);
- else { /* Unknown packet type */
- char *c;
- char method[128];
-
- ast_copy_string(method, p->packets->data, sizeof(method));
- c = ast_skip_blanks(method); /* XXX what ? */
- *c = '\0';
- __sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), find_sip_method(method), FALSE);
- }
+ method = (cur->method) ? cur->method : find_sip_method(cur->data);
+ __sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method, FALSE);
}
return 0;
}