From e89575ddce3e2a794bf411c313829afdfec11b23 Mon Sep 17 00:00:00 2001 From: Artem Boldariev Date: Thu, 27 Oct 2022 21:14:35 +0300 Subject: [PATCH] StreamDNS: opportunistically disable Nagle's algorithm This commit ensures that Stream DNS code attempts to disable Nagle's algorithm regardless of underlying stream transport (TCP or TLS), as we are not interested in trading latency for throughout when dealing with DNS messages. --- lib/isc/netmgr/streamdns.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/isc/netmgr/streamdns.c b/lib/isc/netmgr/streamdns.c index 6e3a5bfe5b..c72697c8f3 100644 --- a/lib/isc/netmgr/streamdns.c +++ b/lib/isc/netmgr/streamdns.c @@ -356,6 +356,7 @@ streamdns_transport_connected(isc_nmhandle_t *handle, isc_result_t result, streamdns_save_alpn_status(sock, handle); isc__nmhandle_set_manual_timer(sock->outerhandle, true); streamhandle = isc__nmhandle_get(sock, &sock->peer, &sock->iface); + (void)isc_nmhandle_set_tcp_nodelay(sock->outerhandle, true); streamdns_call_connect_cb(sock, streamhandle, result); isc_nmhandle_detach(&streamhandle); @@ -720,6 +721,7 @@ streamdns_accept_cb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) { isc_nm_gettimeouts(nsock->worker->netmgr, &initial, NULL, NULL, NULL); /* settimeout restarts the timer */ isc_nmhandle_settimeout(nsock->outerhandle, initial); + (void)isc_nmhandle_set_tcp_nodelay(nsock->outerhandle, true); streamdns_handle_incoming_data(nsock, nsock->outerhandle, NULL, 0); exit: