Fix Tor support does not use all available HTTP seeds.

This commit is contained in:
Andreas Schildbach
2015-08-24 13:00:37 +02:00
parent f43f2e30b2
commit 1e24a7aab7

View File

@@ -328,9 +328,12 @@ public class PeerGroup implements TransactionBroadcaster {
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
if (httpSeeds.length > 0) {
// Use HTTP discovery when Tor is active and there is a Cartographer seed, for a much needed speed boost.
OkHttpClient client = new OkHttpClient();
client.setSocketFactory(torClient.getSocketFactory());
result.addPeerDiscovery(new HttpDiscovery(params, httpSeeds[0], client));
OkHttpClient httpClient = new OkHttpClient();
httpClient.setSocketFactory(torClient.getSocketFactory());
List<PeerDiscovery> discoveries = Lists.newArrayList();
for (HttpDiscovery.Details httpSeed : httpSeeds)
discoveries.add(new HttpDiscovery(params, httpSeed, httpClient));
result.addPeerDiscovery(new MultiplexingDiscovery(params, discoveries));
} else {
result.addPeerDiscovery(new TorDiscovery(params, torClient));
}