2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Use the configured TCP connect timeout in notify_send_toaddr()

The notify_send_toaddr() function uses hardcoded timeout values
for both UDP and TCP, however, with TCP named has configurable
timeout values. Slightly refactor the timeouts calculation part
and use the configured 'tcp-initial-timeout' value as the connect
timeout.
This commit is contained in:
Aram Sargsyan
2025-02-18 17:07:15 +00:00
committed by Arаm Sаrgsyаn
parent 70ad94257d
commit daede6876b

View File

@@ -12619,7 +12619,7 @@ notify_send_toaddr(void *arg) {
dns_tsigkey_t *key = NULL;
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t src;
unsigned int options, connect_timeout, timeout, udptimeout;
unsigned int options;
bool have_notifysource = false;
isc_tlsctx_cache_t *zmgr_tlsctx_cache = NULL;
@@ -12729,14 +12729,14 @@ notify_send_toaddr(void *arg) {
goto cleanup_key;
}
udptimeout = 5;
connect_timeout = timeout = 3 * udptimeout + 1;
uint32_t initial_timeout;
isc_nm_gettimeouts(notify->zone->zmgr->netmgr, &initial_timeout, NULL,
NULL, NULL, NULL);
const unsigned int connect_timeout = initial_timeout / MS_PER_SEC;
again:
if ((notify->flags & DNS_NOTIFY_TCP) != 0) {
options |= DNS_REQUESTOPT_TCP;
udptimeout = 0;
timeout = 15;
}
zmgr_tlsctx_attach(notify->zone->zmgr, &zmgr_tlsctx_cache);
@@ -12744,8 +12744,9 @@ again:
result = dns_request_create(
notify->zone->view->requestmgr, message, &src, &notify->dst,
notify->transport, zmgr_tlsctx_cache, options, key,
connect_timeout, timeout, udptimeout, 2, notify->zone->loop,
notify_done, notify, &notify->request);
connect_timeout, TCP_REQUEST_TIMEOUT, UDP_REQUEST_TIMEOUT,
UDP_REQUEST_RETRIES, notify->zone->loop, notify_done, notify,
&notify->request);
isc_tlsctx_cache_detach(&zmgr_tlsctx_cache);