From 63b92e6dd620aec9663170034f979623d025f68d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 28 Jan 2024 12:54:16 -0500 Subject: [PATCH] Better caching --- core/src/mindustry/net/Dns.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/net/Dns.java b/core/src/mindustry/net/Dns.java index a59b803eff..cc9e400cde 100644 --- a/core/src/mindustry/net/Dns.java +++ b/core/src/mindustry/net/Dns.java @@ -97,7 +97,9 @@ public class Dns{ }, addresses -> { try{ if(addresses.size > 0){ - result.get(InetAddress.getByAddress(addresses.get(0))); + var address = InetAddress.getByAddress(addresses.get(0)); + domainToIp.put(domain, address); + result.get(address); }else{ //there are no records found - try AAAA instead. resolve(aaaaRecord, domain, bytes -> { @@ -108,7 +110,9 @@ public class Dns{ try{ if(addresses2.size > 0){ - result.get(InetAddress.getByAddress(addresses2.get(0))); + var address = InetAddress.getByAddress(addresses2.get(0)); + domainToIp.put(domain, address); + result.get(address); }else{ //there are no records found error.get(new UnresolvedAddressException());