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

add isc_nmhandle_settimeout() function

this function sets the read timeout for the socket associated
with a netmgr handle and, if the timer is running, resets it.
for TCPDNS sockets it also sets the read timeout and resets the
timer on the outer TCP socket.
This commit is contained in:
Evan Hunt
2020-11-02 19:58:05 -08:00
committed by Ondřej Surý
parent e12dc1faa2
commit 4be63c5b00
7 changed files with 127 additions and 14 deletions

View File

@@ -1146,3 +1146,18 @@ isc__nm_async_udpcancel(isc__networker_t *worker, isc__netievent_t *ev0) {
isc_nmhandle_detach(&handle);
}
void
isc__nm_udp_settimeout(isc_nmhandle_t *handle, uint32_t timeout) {
isc_nmsocket_t *sock = NULL;
REQUIRE(VALID_NMHANDLE(handle));
sock = handle->sock;
sock->read_timeout = timeout;
if (sock->timer_running) {
uv_timer_start(&sock->timer, readtimeout_cb, sock->read_timeout,
0);
}
}