Wed Mar 4 12:22:20 CST 2009 Pekka Pessi <first.last@nokia.com>

* nta: fix timer N3
  Ignore-this: 4018f3a32723692153389c2109b72296
  
  Try UDP instead of TCP if TCP server does not respond quick enough.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12417 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-03-04 20:35:51 +00:00
parent a9fcad1aca
commit 3446ae280f
2 changed files with 13 additions and 9 deletions

View File

@ -1 +1 @@
Tue Mar 3 16:01:38 CST 2009
Wed Mar 4 14:35:03 CST 2009

View File

@ -7021,7 +7021,7 @@ static void outgoing_prepare_send(nta_outgoing_t *orq);
static void outgoing_send_via(nta_outgoing_t *orq, tport_t *tp);
static void outgoing_send(nta_outgoing_t *orq, int retransmit);
static void outgoing_try_tcp_instead(nta_outgoing_t *orq);
static void outgoing_try_udp_instead(nta_outgoing_t *orq);
static void outgoing_try_udp_instead(nta_outgoing_t *orq, int timeout);
static void outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
tport_t *tp, msg_t *msg, int error);
static void outgoing_print_tport_error(nta_outgoing_t *orq,
@ -8024,7 +8024,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit)
}
else if (err == ECONNREFUSED && orq->orq_try_tcp_instead) {
if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
outgoing_try_udp_instead(orq);
outgoing_try_udp_instead(orq, 0);
continue;
}
}
@ -8138,7 +8138,7 @@ outgoing_try_tcp_instead(nta_outgoing_t *orq)
}
static void
outgoing_try_udp_instead(nta_outgoing_t *orq)
outgoing_try_udp_instead(nta_outgoing_t *orq, int timeout)
{
tport_t *tp;
tp_name_t tpn[1];
@ -8160,8 +8160,9 @@ outgoing_try_udp_instead(nta_outgoing_t *orq)
sip_fragment_clear(sip->sip_via->v_common);
sip->sip_via->v_protocol = sip_transport_udp;
SU_DEBUG_5(("nta: %s (%u) TCP refused, trying UDP\n",
orq->orq_method_name, orq->orq_cseq->cs_seq));
SU_DEBUG_5(("nta: %s (%u) TCP %s, trying UDP\n",
orq->orq_method_name, orq->orq_cseq->cs_seq,
timeout ? "times out" : "refused"));
orq->orq_tpn->tpn_proto = "udp";
tport_decref(&orq->orq_tport);
@ -8196,7 +8197,7 @@ outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
outgoing_print_tport_error(orq, 5, "retrying with UDP after ",
tpn, msg, error);
outgoing_try_udp_instead(orq);
outgoing_try_udp_instead(orq, 0);
outgoing_remove(orq); /* Reset state - this is no resend! */
outgoing_send(orq, 0); /* Send */
return;
@ -8601,8 +8602,11 @@ static void outgoing_timer(nta_agent_t *sa)
* but no connection is established within SIP T4
*/
SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n", "N3",
"try UDP instead", orq->orq_method_name, orq->orq_cseq->cs_seq));
outgoing_try_udp_instead(orq);
"try UDP instead for",
orq->orq_method_name, orq->orq_cseq->cs_seq));
outgoing_try_udp_instead(orq, 1);
outgoing_remove(orq); /* Reset state - this is no resend! */
outgoing_send(orq, 0); /* Send */
}
continue;
}