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

Make it possible to recover from read timeouts

Previously, when the client timed out on read, the client socket would
be automatically closed and destroyed when the nmhandle was detached.
This commit changes the logic so that it's possible for the callback to
recover from the ISC_R_TIMEDOUT event by restarting the timer. This is
done by calling isc_nmhandle_settimeout(), which prevents the timeout
handling code from destroying the socket; instead, it continues to wait
for data.

One specific use case for multiple timeouts is serve-stale - the client
socket could be created with shorter timeout (as specified with
stale-answer-client-timeout), so we can serve the requestor with stale
answer, but keep the original query running for a longer time.
This commit is contained in:
Ondřej Surý
2021-03-29 10:52:05 +02:00
committed by Ondřej Surý
parent 0aad979175
commit 33c00c281f
3 changed files with 54 additions and 47 deletions

View File

@@ -854,8 +854,6 @@ struct isc_nmsocket {
* TCP read/connect timeout timers.
*/
uv_timer_t timer;
bool timer_initialized;
bool timer_running;
uint64_t read_timeout;
uint64_t connect_timeout;
@@ -1167,8 +1165,10 @@ void
isc__nmsocket_timer_start(isc_nmsocket_t *sock);
void
isc__nmsocket_timer_restart(isc_nmsocket_t *sock);
bool
isc__nmsocket_timer_running(isc_nmsocket_t *sock);
/*%<
* Start/stop/restart the read timeout on the socket
* Start/stop/restart/check the timeout on the socket
*/
void