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

Jenkins2 asteriskteam at digium.com
Mon Jan 15 10:38:44 CST 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7958 )

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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Jenkins2: Approved for Submit



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/7958
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I5b1ef4b882f7b859e718236686b7898751dbb262
Gerrit-Change-Number: 7958
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180115/a33393bc/attachment.html>


More information about the asterisk-code-review mailing list