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

Add TCP, TCPDNS and TLSDNS write timer

When the outgoing TCP write buffers are full because the other party is
not reading the data, the uv_write() could wait indefinitely on the
uv_loop and never calling the callback.  Add a new write timer that uses
the `tcp-idle-timeout` value to interrupt the TCP connection when we are
not able to send data for defined period of time.
This commit is contained in:
Ondřej Surý
2022-02-09 11:21:04 +01:00
parent cd3b58622c
commit 408b362169
6 changed files with 215 additions and 30 deletions

View File

@@ -954,6 +954,13 @@ struct isc_nmsocket {
uint64_t read_timeout;
uint64_t connect_timeout;
/*%
* TCP write timeout timer.
*/
uv_timer_t write_timer;
uint64_t write_timeout;
int64_t writes;
/*% outer socket is for 'wrapped' sockets - e.g. tcpdns in tcp */
isc_nmsocket_t *outer;
@@ -2071,12 +2078,25 @@ isc__nm_failed_connect_cb(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
void
isc__nm_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result, bool async);
void
isc__nmsocket_connecttimeout_cb(uv_timer_t *timer);
void
isc__nm_accept_connection_log(isc_result_t result, bool can_log_quota);
/*
* Timeout callbacks
*/
void
isc__nmsocket_connecttimeout_cb(uv_timer_t *timer);
void
isc__nmsocket_readtimeout_cb(uv_timer_t *timer);
void
isc__nmsocket_writetimeout_cb(uv_timer_t *timer);
/*%<
*
* Maximum number of simultaneous handles in flight supported for a single
* connected TCPDNS socket. This value was chosen arbitrarily, and may be
* changed in the future.
*/
#define STREAM_CLIENTS_PER_CONN 23
#define UV_RUNTIME_CHECK(func, ret) \