From a28c33645c466a45711ce7912d31708080fdeb43 Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Mon, 2 Jun 2025 09:29:36 -0600 Subject: [PATCH] dns: fix dns query cache implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/58404 Refs: https://github.com/nodejs/node/pull/57640 Reviewed-By: Juan José Arboleda Reviewed-By: Matteo Collina Reviewed-By: Tim Perry --- src/cares_wrap.cc | 6 +++--- test/parallel/test-dns.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 6290bcd37f3..5016c3d51da 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -879,9 +879,9 @@ void ChannelWrap::Setup() { } /* We do the call to ares_init_option for caller. */ - const int optmask = - ARES_OPT_FLAGS | ARES_OPT_TIMEOUTMS | - ARES_OPT_SOCK_STATE_CB | ARES_OPT_TRIES; + const int optmask = ARES_OPT_FLAGS | ARES_OPT_TIMEOUTMS | + ARES_OPT_SOCK_STATE_CB | ARES_OPT_TRIES | + ARES_OPT_QUERY_CACHE; r = ares_init_options(&channel_, &options, optmask); if (r != ARES_SUCCESS) { diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index a6b3e459aa0..7d67b09d58f 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -415,7 +415,7 @@ assert.throws(() => { (answer) => Object.assign({ domain }, answer) ), }), port, address); - }, cases.length * 2 - 1)); + }, cases.length * 2)); server.bind(0, common.mustCall(() => { const address = server.address();