2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Change single write timer to per-send timers

Previously, there was a single per-socket write timer that would get
restarted for every new write.  This turned out to be insufficient
because the other side could keep reseting the timer, and never reading
back the responses.

Change the single write timer to per-send timer which would in turn
reset the TCP connection on the first send timeout.
This commit is contained in:
Ondřej Surý
2022-03-10 13:51:08 +01:00
parent 1357d44605
commit a761aa59e3
7 changed files with 71 additions and 186 deletions

View File

@@ -377,15 +377,15 @@ struct isc__nm_uvreq {
int magic;
isc_nmsocket_t *sock;
isc_nmhandle_t *handle;
char tcplen[2]; /* The TCP DNS message length */
uv_buf_t uvbuf; /* translated isc_region_t, to be
* sent or received */
isc_sockaddr_t local; /* local address */
isc_sockaddr_t peer; /* peer address */
isc__nm_cb_t cb; /* callback */
void *cbarg; /* callback argument */
uv_pipe_t ipc; /* used for sending socket
* uv_handles to other threads */
char tcplen[2]; /* The TCP DNS message length */
uv_buf_t uvbuf; /* translated isc_region_t, to be
* sent or received */
isc_sockaddr_t local; /* local address */
isc_sockaddr_t peer; /* peer address */
isc__nm_cb_t cb; /* callback */
void *cbarg; /* callback argument */
isc_nm_timer_t *timer; /* TCP write timer */
union {
uv_handle_t handle;
uv_req_t req;
@@ -972,9 +972,7 @@ struct isc_nmsocket {
/*%
* 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;
@@ -2097,7 +2095,7 @@ 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);
isc__nmsocket_writetimeout_cb(void *data, isc_result_t eresult);
#define UV_RUNTIME_CHECK(func, ret) \
if (ret != 0) { \