From 67a850e665a17c77afce52597aec004e0c1aa8ea Mon Sep 17 00:00:00 2001 From: Alex Clayton Date: Thu, 19 Sep 2013 09:37:01 +0100 Subject: Fix PlatformDomainNameResolve DomainNameAddressQuery In the PlatformDomainNameResolver class there is a DomainNameAddressQuery class (accesible via DomainNameResolver->createAddressQuery()) for performing a DNS lookup on a given domainname. This should have been returing the set of all HostAddress associated with a given domain, but instead was only returning a singleton set (or empty if there was no dns). This patch fixes this by changing the method call from InetAddress.getByName() to InetAddress.getAllByName(). Test-information: Tested on top of my MLC Diagnose SRV patch. For 'google.com' we now see a full list of ip addresses associated with it, rather then just the one. Change-Id: I6e57c16bb64f76048f16bcff8ee9c1924049a051 diff --git a/src/com/isode/stroke/network/PlatformDomainNameResolver.java b/src/com/isode/stroke/network/PlatformDomainNameResolver.java index ccdee6d..3eef682 100644 --- a/src/com/isode/stroke/network/PlatformDomainNameResolver.java +++ b/src/com/isode/stroke/network/PlatformDomainNameResolver.java @@ -25,7 +25,9 @@ public class PlatformDomainNameResolver extends DomainNameResolver { public void run() { final Collection results = new ArrayList(); try { - results.add(new HostAddress(InetAddress.getByName(hostname))); + for (InetAddress result : InetAddress.getAllByName(hostname)) { + results.add(new HostAddress(result)); + } } catch (UnknownHostException ex) { } eventLoop.postEvent(new Callback() { -- cgit v0.10.2-6-g49f6