From 81e1edffa9e599a2a589dfad7270532969ddfd41 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 12 Aug 2008 17:06:11 +0000 Subject: [PATCH] Wed Aug 6 14:49:13 EDT 2008 Pekka Pessi * nta: fix to #2037585: always release error callback when changing transports git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9274 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 29 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 7612a61d31..50310070ba 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Aug 12 13:04:52 EDT 2008 +Tue Aug 12 13:06:05 EDT 2008 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 98197ece65..577e88f173 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -7343,6 +7343,12 @@ outgoing_send_via(nta_outgoing_t *orq, tport_t *tp) orq->orq_tport = tport_ref(tp); + if (orq->orq_pending && tp != old_tp) { + tport_release(old_tp, orq->orq_pending, + orq->orq_request, NULL, orq, 0); + orq->orq_pending = 0; + } + if (old_tp) tport_unref(old_tp); if (outgoing_insert_via(orq, agent_tport_via(tp)) < 0) { @@ -7441,6 +7447,12 @@ outgoing_send(nta_outgoing_t *orq, int retransmit) if (orq->orq_try_udp_instead) tag = tptag_mtu, value = 65535; + if (orq->orq_pending) { + tport_release(orq->orq_tport, orq->orq_pending, + orq->orq_request, NULL, orq, 0); + orq->orq_pending = 0; + } + tp = tport_tsend(orq->orq_tport, msg, tpn, tag, value, IF_SIGCOMP_TPTAG_COMPARTMENT(cc) @@ -7477,12 +7489,6 @@ outgoing_send(nta_outgoing_t *orq, int retransmit) } } - if (orq->orq_pending && orq->orq_tport) - tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request, - NULL, orq, 0); - - orq->orq_pending = 0; - outgoing_tport_error(agent, orq, NULL, orq->orq_request, err); return; @@ -7548,6 +7554,8 @@ outgoing_try_tcp_instead(nta_outgoing_t *orq) tport_t *tp; tp_name_t tpn[1]; + assert(orq->orq_pending == 0); + *tpn = *orq->orq_tpn; tpn->tpn_proto = "tcp"; orq->orq_try_tcp_instead = 1; @@ -7568,8 +7576,9 @@ outgoing_try_tcp_instead(nta_outgoing_t *orq) return; } + /* No TCP - try again with UDP without SIP MTU limit */ tpn->tpn_proto = "udp"; - orq->orq_try_udp_instead = 1; /* Try again without SIP MTU limit */ + orq->orq_try_udp_instead = 1; tp = tport_by_name(orq->orq_agent->sa_tports, tpn); if (tp && tp != orq->orq_tport) { @@ -7587,6 +7596,12 @@ outgoing_try_udp_instead(nta_outgoing_t *orq) tport_t *tp; tp_name_t tpn[1]; + if (orq->orq_pending) { + tport_release(orq->orq_tport, orq->orq_pending, + orq->orq_request, NULL, orq, 0); + orq->orq_pending = 0; + } + *tpn = *orq->orq_tpn; tpn->tpn_proto = "udp"; orq->orq_try_udp_instead = 1;