[asterisk-commits] PJSIP: provide valid tcp nodelay option for reuse (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 7 13:09:14 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: PJSIP: provide valid tcp nodelay option for reuse
......................................................................


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
---
M res/res_pjsip/config_transport.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c
index b920897..60b4507 100644
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -562,12 +562,13 @@
 		}
 	} 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;

-- 
To view, visit https://gerrit.asterisk.org/3150
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3251164c7f710dbdab031282f00e30a9770626a0
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list