diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2009-06-08 15:30:38 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2009-06-08 15:30:38 +0000 |
commit | 0a4ec5a59e51744adabf1307fe7e416f08dd4263 (patch) | |
tree | e389ac1e7f4fbedacee06f3959c9a40fc9ada57a | |
parent | e8a7866ff3c1122d4757a67820b83b6ee1c3efd7 (diff) |
Ticket #831: Added compile-time option to disable/prevent transport switching to TCP.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2756 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/include/pjsip/sip_config.h | 18 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_util.c | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h index d0dde3ed..fe4fbe24 100644 --- a/pjsip/include/pjsip/sip_config.h +++ b/pjsip/include/pjsip/sip_config.h @@ -233,14 +233,28 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void) * using an RFC 2914 [43] congestion controlled transport protocol, such * as TCP. * + * Disable the behavior of automatic switching to TCP whenever UDP packet + * size exceeds the threshold defined in PJSIP_UDP_SIZE_THRESHOLD. + * + * Default is 0 (no). + */ +#ifndef PJSIP_DONT_SWITCH_TO_TCP +# define PJSIP_DONT_SWITCH_TO_TCP 0 +#endif + + +/** * This setting controls the threshold of the UDP packet, which if it's - * larger than this value the request will be sent with TCP. Default is - * 1300 bytes. + * larger than this value the request will be sent with TCP. This setting + * is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0. + * + * Default is 1300 bytes. */ #ifndef PJSIP_UDP_SIZE_THRESHOLD # define PJSIP_UDP_SIZE_THRESHOLD 1300 #endif + /** * Encode SIP headers in their short forms to reduce size. By default, * SIP headers in outgoing messages will be encoded in their full names. diff --git a/pjsip/src/pjsip/sip_util.c b/pjsip/src/pjsip/sip_util.c index 959cc3b2..66aa4636 100644 --- a/pjsip/src/pjsip/sip_util.c +++ b/pjsip/src/pjsip/sip_util.c @@ -1190,6 +1190,7 @@ stateless_send_resolver_callback( pj_status_t status, /* Copy server addresses */ pj_memcpy( &stateless_data->addr, addr, sizeof(pjsip_server_addresses)); +#if !defined(PJSIP_DONT_SWITCH_TO_TCP) || PJSIP_DONT_SWITCH_TO_TCP==0 /* RFC 3261 section 18.1.1: * If a request is within 200 bytes of the path MTU, or if it is larger * than 1300 bytes and the path MTU is unknown, the request MUST be sent @@ -1234,6 +1235,7 @@ stateless_send_resolver_callback( pj_status_t status, stateless_data->addr.count = count * 2; } } +#endif /* !PJSIP_DONT_SWITCH_TO_TCP */ /* Process the addresses. */ stateless_send_transport_cb( stateless_data, stateless_data->tdata, |