mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Cleanup
This commit is contained in:
parent
ada683805b
commit
8360f3b0e3
3 changed files with 7 additions and 19 deletions
|
@ -90,7 +90,6 @@ public class ProvidersRepository {
|
|||
else
|
||||
log.warn("We received banned provider nodes: bannedNodes={}, selected baseUrl={}, providerList={}",
|
||||
bannedNodes, baseUrl, providerList);
|
||||
|
||||
}
|
||||
|
||||
public void selectNewRandomBaseUrl() {
|
||||
|
|
|
@ -405,17 +405,8 @@ public class MainViewModel implements ViewModel {
|
|||
initWalletService();
|
||||
|
||||
// We want to get early connected to the price relay so we call it already now
|
||||
long ts = new Date().getTime();
|
||||
final boolean[] logged = {false};
|
||||
priceFeedService.setCurrencyCodeOnInit();
|
||||
priceFeedService.requestPriceFeed(price -> {
|
||||
if (!logged[0]) {
|
||||
log.info("We received data from the price relay after {} ms.",
|
||||
(new Date().getTime() - ts));
|
||||
logged[0] = true;
|
||||
}
|
||||
},
|
||||
(errorMessage, throwable) -> log.error("requestPriceFeed failed:" + errorMessage));
|
||||
priceFeedService.initialRequestPriceFeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;
|
|||
import io.bisq.common.app.Version;
|
||||
import io.bisq.network.Socks5ProxyProvider;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
|
@ -14,8 +15,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.ssl.SSLContexts;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
@ -31,9 +30,8 @@ import java.util.UUID;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
// TODO close connection if failing
|
||||
@Slf4j
|
||||
public class HttpClient {
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpClient.class);
|
||||
|
||||
@Nullable
|
||||
private Socks5ProxyProvider socks5ProxyProvider;
|
||||
@Getter
|
||||
|
@ -142,19 +140,19 @@ public class HttpClient {
|
|||
new PoolingHttpClientConnectionManager(reg) :
|
||||
new PoolingHttpClientConnectionManager(reg, new FakeDnsResolver());
|
||||
try (CloseableHttpClient httpclient = HttpClients.custom().setConnectionManager(cm).build()) {
|
||||
InetSocketAddress socksaddr = new InetSocketAddress(socks5Proxy.getInetAddress(), socks5Proxy.getPort());
|
||||
InetSocketAddress socksAddress = new InetSocketAddress(socks5Proxy.getInetAddress(), socks5Proxy.getPort());
|
||||
|
||||
// remove me: Use this to test with system-wide Tor proxy, or change port for another proxy.
|
||||
// InetSocketAddress socksaddr = new InetSocketAddress("127.0.0.1", 9050);
|
||||
// InetSocketAddress socksAddress = new InetSocketAddress("127.0.0.1", 9050);
|
||||
|
||||
HttpClientContext context = HttpClientContext.create();
|
||||
context.setAttribute("socks.address", socksaddr);
|
||||
context.setAttribute("socks.address", socksAddress);
|
||||
|
||||
HttpGet request = new HttpGet(baseUrl + param);
|
||||
if (headerKey != null && headerValue != null)
|
||||
request.setHeader(headerKey, headerValue);
|
||||
|
||||
log.debug("Executing request " + request + " proxy: " + socksaddr);
|
||||
log.debug("Executing request " + request + " proxy: " + socksAddress);
|
||||
try (CloseableHttpResponse response = httpclient.execute(request, context)) {
|
||||
return convertInputStreamToString(response.getEntity().getContent());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue