diff options
author | Scott Griepentrog <scott@griepentrog.com> | 2016-07-07 10:55:42 -0500 |
---|---|---|
committer | Scott Griepentrog <sgriepentrog@digium.com> | 2016-07-07 11:32:58 -0500 |
commit | fb96492ec49b75eb8b6d60e1ce5b68cd8b57c1df (patch) | |
tree | 7e3470a608bb4996a4dc052e920f5a9bb533d527 /res/res_pjsip | |
parent | 9e10aa84969b3b6e57dde5a637c47f17f1fd4ef7 (diff) |
PJSIP: provide valid tcp nodelay option for reuse
When using TCP transport with chan_pjsip, the TCP_NODELAY
option value was allocated on the stack, then passed as a
pointer to the tcp transport configuration structure, and
later re-used on subsequently created sockets when it was
no longer valid. This patch changes the allocation to be
a static.
ASTERISK-26180 #close
Reported by: Scott Griepentrog
Change-Id: I3251164c7f710dbdab031282f00e30a9770626a0
Diffstat (limited to 'res/res_pjsip')
-rw-r--r-- | res/res_pjsip/config_transport.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c index b9208976f..60b4507cd 100644 --- a/res/res_pjsip/config_transport.c +++ b/res/res_pjsip/config_transport.c @@ -562,12 +562,13 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj) } } else if (transport->type == AST_TRANSPORT_TCP) { pjsip_tcp_transport_cfg cfg; - int option = 1; + static int option = 1; pjsip_tcp_transport_cfg_default(&cfg, temp_state->state->host.addr.sa_family); cfg.bind_addr = temp_state->state->host; cfg.async_cnt = transport->async_operations; set_qos(transport, &cfg.qos_params); + /* sockopt_params.options is copied to each newly connected socket */ cfg.sockopt_params.options[0].level = pj_SOL_TCP(); cfg.sockopt_params.options[0].optname = pj_TCP_NODELAY(); cfg.sockopt_params.options[0].optval = &option; |