Better caching

This commit is contained in:
Anuken 2024-01-28 12:54:16 -05:00
parent 3be67aa52a
commit 63b92e6dd6

View File

@ -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());