mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-03 05:57:21 +00:00
Fix Tor support does not use all available HTTP seeds.
This commit is contained in:
@@ -328,9 +328,12 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
|
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
|
||||||
if (httpSeeds.length > 0) {
|
if (httpSeeds.length > 0) {
|
||||||
// Use HTTP discovery when Tor is active and there is a Cartographer seed, for a much needed speed boost.
|
// Use HTTP discovery when Tor is active and there is a Cartographer seed, for a much needed speed boost.
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient httpClient = new OkHttpClient();
|
||||||
client.setSocketFactory(torClient.getSocketFactory());
|
httpClient.setSocketFactory(torClient.getSocketFactory());
|
||||||
result.addPeerDiscovery(new HttpDiscovery(params, httpSeeds[0], client));
|
List<PeerDiscovery> discoveries = Lists.newArrayList();
|
||||||
|
for (HttpDiscovery.Details httpSeed : httpSeeds)
|
||||||
|
discoveries.add(new HttpDiscovery(params, httpSeed, httpClient));
|
||||||
|
result.addPeerDiscovery(new MultiplexingDiscovery(params, discoveries));
|
||||||
} else {
|
} else {
|
||||||
result.addPeerDiscovery(new TorDiscovery(params, torClient));
|
result.addPeerDiscovery(new TorDiscovery(params, torClient));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user