3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 23:32:16 +00:00

Handle null hostNames in DnsDiscovery (some NP have that).

This commit is contained in:
Matt Corallo 2013-06-07 12:45:46 +02:00 committed by Mike Hearn
parent c9d411e8e7
commit 518b7edcbd

View File

@ -67,6 +67,9 @@ public class DnsDiscovery implements PeerDiscovery {
}
public InetSocketAddress[] getPeers(long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException {
if (hostNames == null)
throw new PeerDiscoveryException("Unable to find any peers via DNS");
// Java doesn't have an async DNS API so we have to do all lookups in a thread pool, as sometimes seeds go
// hard down and it takes ages to give up and move on.
ExecutorService threadPool = Executors.newFixedThreadPool(hostNames.length);