From 1da9d42065d712ca68d44a0386f8477181ac103c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 24 Oct 2023 19:16:47 +0200 Subject: [PATCH] retrieve DNS response from cache --- src/main/java/de/gultsch/minidns/AndroidDNSClient.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/gultsch/minidns/AndroidDNSClient.java b/src/main/java/de/gultsch/minidns/AndroidDNSClient.java index d47430339..047799815 100644 --- a/src/main/java/de/gultsch/minidns/AndroidDNSClient.java +++ b/src/main/java/de/gultsch/minidns/AndroidDNSClient.java @@ -70,6 +70,9 @@ public class AndroidDNSClient extends AbstractDNSClient { for (final DNSServer dnsServer : getDNSServers()) { final QuestionServerTuple cacheKey = new QuestionServerTuple(dnsServer, question); final DNSMessage cachedResponse = queryCache(cacheKey); + if (cachedResponse != null) { + return cachedResponse; + } final DNSMessage response = this.networkDataSource.query(question, dnsServer); if (response == null) { continue;