3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 03:35:52 +00:00

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 2c8ffc84ec
commit a12ec7f49d

View File

@ -337,9 +337,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));
}