summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2022-09-06 15:35:54 +0100
committerSimon Kelley <simon@thekelleys.org.uk>2022-09-06 15:35:54 +0100
commitd6c69f6bdba8e2a138faa6c422f5fd29545f1f06 (patch)
treeac7df052cdad7b9add134690354fc480fabba8bf
parentce372917fef8e89a2a928735a2470f6d9c0e253c (diff)
downloaddnsmasq-d6c69f6bdba8e2a138faa6c422f5fd29545f1f06.tar.gz
Free sockets awaiting upstream DNS replies ASAP.
Once we have a good answer, close the socket so that the fd can be reused during DNSSEC validation and we don't have to read and discard more replies from other servers.
-rw-r--r--src/forward.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/forward.c b/src/forward.c
index e8249a6..f90be2f 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -1144,6 +1144,13 @@ void reply_query(int fd, time_t now)
}
forward->sentto = server;
+
+ /* We have a good answer, and will now validate it or return it.
+ It may be some time before this the validation completes, but we don't need
+ any more answers, so close the socket(s) on which we were expecting
+ answers, to conserve file descriptors, and to save work reading and
+ discarding answers for other upstreams. */
+ free_rfds(&forward->rfds);
#ifdef HAVE_DNSSEC
if ((forward->sentto->flags & SERV_DO_DNSSEC) &&