2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

TCP: make it possible to set Nagle's algorithms state via handle

This commit adds ability to turn the Nagle's algorithm on or off via
connections handle. It adds the isc_nmhandle_set_tcp_nodelay()
function as the public interface for this functionality.
This commit is contained in:
Artem Boldariev
2022-08-25 22:18:15 +03:00
parent 4606384345
commit 371b02f37a
2 changed files with 37 additions and 0 deletions

View File

@@ -3013,6 +3013,31 @@ isc__nmhandle_get_selected_alpn(isc_nmhandle_t *handle,
};
}
isc_result_t
isc_nmhandle_set_tcp_nodelay(isc_nmhandle_t *handle, const bool value) {
isc_result_t result = ISC_R_FAILURE;
isc_nmsocket_t *sock;
REQUIRE(VALID_NMHANDLE(handle));
sock = handle->sock;
REQUIRE(VALID_NMSOCK(sock));
switch (sock->type) {
case isc_nm_tcpsocket: {
uv_os_fd_t tcp_fd = (uv_os_fd_t)-1;
(void)uv_fileno((uv_handle_t *)&sock->uv_handle.tcp, &tcp_fd);
RUNTIME_CHECK(tcp_fd != (uv_os_fd_t)-1);
result = isc__nm_socket_tcp_nodelay((uv_os_sock_t)tcp_fd,
value);
} break;
default:
UNREACHABLE();
break;
};
return (result);
}
#ifdef NETMGR_TRACE
/*
* Dump all active sockets in netmgr. We output to stderr