From 4b9962d4a3f2cc4c7595b2ca87042bc18709da82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= Date: Thu, 5 Mar 2020 22:56:31 +0100 Subject: [PATCH] Only use tcpdns timer if it's initialized. --- lib/isc/netmgr/tcpdns.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c index 379ff99bf3..11d338593d 100644 --- a/lib/isc/netmgr/tcpdns.c +++ b/lib/isc/netmgr/tcpdns.c @@ -245,7 +245,9 @@ dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg) { * We have a packet: stop timeout timers */ atomic_store(&dnssock->outer->processing, true); - uv_timer_stop(&dnssock->timer); + if (dnssock->timer_initialized) { + uv_timer_stop(&dnssock->timer); + } if (atomic_load(&dnssock->sequential)) { /* @@ -387,8 +389,10 @@ resume_processing(void *arg) { if (atomic_load(&sock->ah) == 0) { /* Nothing is active; sockets can timeout now */ atomic_store(&sock->outer->processing, false); - uv_timer_start(&sock->timer, dnstcp_readtimeout, - sock->read_timeout, 0); + if (sock->timer_initialized) { + uv_timer_start(&sock->timer, dnstcp_readtimeout, + sock->read_timeout, 0); + } } /* @@ -401,7 +405,9 @@ resume_processing(void *arg) { result = processbuffer(sock, &handle); if (result == ISC_R_SUCCESS) { atomic_store(&sock->outer->processing, true); - uv_timer_stop(&sock->timer); + if (sock->timer_initialized) { + uv_timer_stop(&sock->timer); + } isc_nmhandle_unref(handle); } else if (sock->outer != NULL) { isc_nm_resumeread(sock->outer); @@ -429,7 +435,9 @@ resume_processing(void *arg) { break; } - uv_timer_stop(&sock->timer); + if (sock->timer_initialized) { + uv_timer_stop(&sock->timer); + } atomic_store(&sock->outer->processing, true); isc_nmhandle_unref(dnshandle); } while (atomic_load(&sock->ah) < TCPDNS_CLIENTS_PER_CONN);