From: Ondřej Surý Date: Tue, 2 Jul 2024 18:17:49 +0000 (+0200) Subject: Throttle the reading when writes are asynchronous X-Git-Tag: v9.20.0~3^2~3 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=bc3e713317df838b4bbe6582b357cd8d78e585cd;p=thirdparty%2Fbind9.git Throttle the reading when writes are asynchronous Be more aggressive when throttling the reading - when we can't send the outgoing TCP synchronously with uv_try_write(), we start throttling the reading immediately instead of waiting for the send buffers to fill up. This should not affect behaved clients that read the data from the TCP on the other end. --- diff --git a/lib/isc/netmgr/tcp.c b/lib/isc/netmgr/tcp.c index 71eee4a2d9c..c6bb2812ffa 100644 --- a/lib/isc/netmgr/tcp.c +++ b/lib/isc/netmgr/tcp.c @@ -1145,6 +1145,13 @@ tcp_send_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) { } } + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR, + ISC_LOG_DEBUG(3), + "throttling TCP connection, the other side is not " + "reading the data, switching to uv_write()"); + sock->reading_throttled = true; + isc__nm_stop_reading(sock); + r = uv_write(&req->uv_req.write, &sock->uv_handle.stream, bufs, nbufs, tcp_send_cb); if (r < 0) {