Skip to content
Snippets Groups Projects
Commit fb96492e authored by Scott Griepentrog's avatar Scott Griepentrog Committed by Scott Griepentrog
Browse files

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
parent 9e10aa84
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment