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
This commit is contained in:
parent
9e10aa8496
commit
fb96492ec4
|
@ -562,12 +562,13 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
|
||||||
}
|
}
|
||||||
} else if (transport->type == AST_TRANSPORT_TCP) {
|
} else if (transport->type == AST_TRANSPORT_TCP) {
|
||||||
pjsip_tcp_transport_cfg cfg;
|
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);
|
pjsip_tcp_transport_cfg_default(&cfg, temp_state->state->host.addr.sa_family);
|
||||||
cfg.bind_addr = temp_state->state->host;
|
cfg.bind_addr = temp_state->state->host;
|
||||||
cfg.async_cnt = transport->async_operations;
|
cfg.async_cnt = transport->async_operations;
|
||||||
set_qos(transport, &cfg.qos_params);
|
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].level = pj_SOL_TCP();
|
||||||
cfg.sockopt_params.options[0].optname = pj_TCP_NODELAY();
|
cfg.sockopt_params.options[0].optname = pj_TCP_NODELAY();
|
||||||
cfg.sockopt_params.options[0].optval = &option;
|
cfg.sockopt_params.options[0].optval = &option;
|
||||||
|
|
Loading…
Reference in New Issue