Set default SSL sockopt param to have TCP_NODELAY for GnuTLS backend (#3708)
This commit is contained in:
parent
cde87db7d7
commit
7ff31e3113
|
@ -1078,7 +1078,8 @@ typedef struct pj_ssl_sock_param
|
|||
/**
|
||||
* Specify options to be set on the transport.
|
||||
*
|
||||
* By default there is no options.
|
||||
* For GnuTLS backend, by default TCP_NODELAY will be set. For other
|
||||
* SSL backends, the default is no options.
|
||||
*
|
||||
*/
|
||||
pj_sockopt_params sockopt_params;
|
||||
|
|
|
@ -34,9 +34,21 @@ PJ_DEF(void) pj_ssl_sock_param_default(pj_ssl_sock_param *param)
|
|||
param->async_cnt = 1;
|
||||
param->concurrency = -1;
|
||||
param->whole_data = PJ_TRUE;
|
||||
|
||||
#if (PJ_SSL_SOCK_IMP == PJ_SSL_SOCK_IMP_GNUTLS)
|
||||
/* GnuTLS is allowed to send bigger chunks.*/
|
||||
param->send_buffer_size = 65536;
|
||||
|
||||
{
|
||||
/* For GnuTLS, TCP_NODELAY is needed to avoid polling delay. */
|
||||
static pj_int32_t val = 1;
|
||||
param->sockopt_params.cnt = 1;
|
||||
param->sockopt_params.options[0].level = pj_SOL_TCP();
|
||||
param->sockopt_params.options[0].optname = pj_TCP_NODELAY();
|
||||
param->sockopt_params.options[0].optval = &val;
|
||||
param->sockopt_params.options[0].optlen = sizeof(pj_int32_t);
|
||||
}
|
||||
|
||||
#else
|
||||
param->send_buffer_size = 8192;
|
||||
#endif
|
||||
|
|
|
@ -359,7 +359,8 @@ typedef struct pjsip_tls_setting
|
|||
/**
|
||||
* Specify options to be set on the transport.
|
||||
*
|
||||
* By default there is no options.
|
||||
* By default, this is unset, which means that the underlying sockopt
|
||||
* params as returned by #pj_ssl_sock_param_default() will be used.
|
||||
*
|
||||
*/
|
||||
pj_sockopt_params sockopt_params;
|
||||
|
|
|
@ -342,9 +342,11 @@ static void set_ssock_param(pj_ssl_sock_param *ssock_param,
|
|||
ssock_param->enable_renegotiation =
|
||||
listener->tls_setting.enable_renegotiation;
|
||||
/* Copy the sockopt */
|
||||
pj_memcpy(&ssock_param->sockopt_params,
|
||||
&listener->tls_setting.sockopt_params,
|
||||
sizeof(listener->tls_setting.sockopt_params));
|
||||
if (listener->tls_setting.sockopt_params.cnt > 0) {
|
||||
pj_memcpy(&ssock_param->sockopt_params,
|
||||
&listener->tls_setting.sockopt_params,
|
||||
sizeof(listener->tls_setting.sockopt_params));
|
||||
}
|
||||
|
||||
sip_ssl_method = listener->tls_setting.method;
|
||||
sip_ssl_proto = listener->tls_setting.proto;
|
||||
|
@ -1233,9 +1235,11 @@ static pj_status_t lis_create_transport(pjsip_tpfactory *factory,
|
|||
|
||||
ssock_param.enable_renegotiation = listener->tls_setting.enable_renegotiation;
|
||||
/* Copy the sockopt */
|
||||
pj_memcpy(&ssock_param.sockopt_params,
|
||||
&listener->tls_setting.sockopt_params,
|
||||
sizeof(listener->tls_setting.sockopt_params));
|
||||
if (listener->tls_setting.sockopt_params.cnt > 0) {
|
||||
pj_memcpy(&ssock_param.sockopt_params,
|
||||
&listener->tls_setting.sockopt_params,
|
||||
sizeof(listener->tls_setting.sockopt_params));
|
||||
}
|
||||
|
||||
sip_ssl_method = listener->tls_setting.method;
|
||||
sip_ssl_proto = listener->tls_setting.proto;
|
||||
|
|
Loading…
Reference in New Issue