[Asterisk-code-review] config transport: Enable TCP NODELAY on TLS transports (asterisk[master])

George Joseph asteriskteam at digium.com
Sat Jan 13 13:57:03 CST 2018


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/7959


Change subject: config_transport:  Enable TCP_NODELAY on TLS transports
......................................................................

config_transport:  Enable TCP_NODELAY on TLS transports

We did this for TCP transports already but I'm not sure why we
didn't do it for TLS transports.

ASTERISK_27474 #not_final_fix

Change-Id: I5b1ef4b882f7b859e718236686b7898751dbb262
---
M res/res_pjsip/config_transport.c
1 file changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/59/7959/1

diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c
index a9a90ac..63bf118 100644
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -618,6 +618,8 @@
 				&temp_state->state->factory);
 		}
 	} else if (transport->type == AST_TRANSPORT_TLS) {
+		static int option = 1;
+
 		if (transport->async_operations > 1 && ast_compare_versions(pj_get_version(), "2.5.0") < 0) {
 			ast_log(LOG_ERROR, "Transport: %s: When protocol=tls and pjproject version < 2.5.0, async_operations can't be > 1\n",
 					ast_sorcery_object_get_id(obj));
@@ -627,6 +629,13 @@
 		temp_state->state->tls.password = pj_str((char*)transport->password);
 		set_qos(transport, &temp_state->state->tls.qos_params);
 
+		/* sockopt_params.options is copied to each newly connected socket */
+		temp_state->state->tls.sockopt_params.options[0].level = pj_SOL_TCP();
+		temp_state->state->tls.sockopt_params.options[0].optname = pj_TCP_NODELAY();
+		temp_state->state->tls.sockopt_params.options[0].optval = &option;
+		temp_state->state->tls.sockopt_params.options[0].optlen = sizeof(option);
+		temp_state->state->tls.sockopt_params.cnt = 1;
+
 		for (i = 0; i < BIND_TRIES && res != PJ_SUCCESS; i++) {
 			if (perm_state && perm_state->state && perm_state->state->factory
 				&& perm_state->state->factory->destroy) {

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b1ef4b882f7b859e718236686b7898751dbb262
Gerrit-Change-Number: 7959
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180113/ca3343d0/attachment.html>


More information about the asterisk-code-review mailing list