]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
StreamDNS: opportunistically disable Nagle's algorithm
authorArtem Boldariev <artem@boldariev.com>
Thu, 27 Oct 2022 18:14:35 +0000 (21:14 +0300)
committerArtem Boldariev <artem@boldariev.com>
Tue, 20 Dec 2022 20:13:53 +0000 (22:13 +0200)
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

index 6e3a5bfe5b818b5058dce1f77db2558a8c35e4b6..c72697c8f34dc3144e49d9175c08ba4d455ccf90 100644 (file)
@@ -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: