mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Create new HttpClient for each request.
This commit is contained in:
parent
cafbbdf94c
commit
6a061d2c58
6 changed files with 18 additions and 25 deletions
|
@ -26,8 +26,6 @@ import bisq.core.trade.failed.FailedTradesManager;
|
|||
import bisq.core.trade.statistics.ReferralIdService;
|
||||
import bisq.core.trade.statistics.TradeStatistics2StorageService;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.trade.txproof.AssetTxProofHttpClient;
|
||||
import bisq.core.trade.txproof.xmr.XmrTxProofHttpClient;
|
||||
|
||||
import bisq.common.app.AppModule;
|
||||
import bisq.common.config.Config;
|
||||
|
@ -58,8 +56,6 @@ public class TradeModule extends AppModule {
|
|||
bind(SignedWitnessStorageService.class).in(Singleton.class);
|
||||
bind(ReferralIdService.class).in(Singleton.class);
|
||||
|
||||
bind(AssetTxProofHttpClient.class).to(XmrTxProofHttpClient.class);
|
||||
|
||||
bindConstant().annotatedWith(named(DUMP_STATISTICS)).to(config.dumpStatistics);
|
||||
bindConstant().annotatedWith(named(DUMP_DELAYED_PAYOUT_TXS)).to(config.dumpDelayedPayoutTxs);
|
||||
bindConstant().annotatedWith(named(ALLOW_FAULTY_DELAYED_TXS)).to(config.allowFaultyDelayedTxs);
|
||||
|
|
|
@ -24,8 +24,6 @@ import bisq.network.http.HttpClientImpl;
|
|||
|
||||
import bisq.common.app.DevEnv;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -58,7 +56,6 @@ public class DevTestXmrTxProofHttpClient extends HttpClientImpl implements Asset
|
|||
EXCEPTION
|
||||
}
|
||||
|
||||
@Inject
|
||||
public DevTestXmrTxProofHttpClient(@Nullable Socks5ProxyProvider socks5ProxyProvider) {
|
||||
super(socks5ProxyProvider);
|
||||
}
|
||||
|
|
|
@ -22,14 +22,11 @@ import bisq.core.trade.txproof.AssetTxProofHttpClient;
|
|||
import bisq.network.Socks5ProxyProvider;
|
||||
import bisq.network.http.HttpClientImpl;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class XmrTxProofHttpClient extends HttpClientImpl implements AssetTxProofHttpClient {
|
||||
@Inject
|
||||
public XmrTxProofHttpClient(Socks5ProxyProvider socks5ProxyProvider) {
|
||||
class XmrTxProofHttpClient extends HttpClientImpl implements AssetTxProofHttpClient {
|
||||
XmrTxProofHttpClient(Socks5ProxyProvider socks5ProxyProvider) {
|
||||
super(socks5ProxyProvider);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import bisq.core.trade.txproof.AssetTxProofHttpClient;
|
|||
import bisq.core.trade.txproof.AssetTxProofParser;
|
||||
import bisq.core.trade.txproof.AssetTxProofRequest;
|
||||
|
||||
import bisq.network.Socks5ProxyProvider;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
import bisq.common.app.Version;
|
||||
import bisq.common.handlers.FaultHandler;
|
||||
|
@ -140,9 +142,9 @@ class XmrTxProofRequest implements AssetTxProofRequest<XmrTxProofRequest.Result>
|
|||
private final ListeningExecutorService executorService = Utilities.getListeningExecutorService(
|
||||
"XmrTransferProofRequester", 3, 5, 10 * 60);
|
||||
|
||||
private final AssetTxProofHttpClient httpClient;
|
||||
private final AssetTxProofParser<XmrTxProofRequest.Result, XmrTxProofModel> parser;
|
||||
private final XmrTxProofModel model;
|
||||
private final AssetTxProofHttpClient httpClient;
|
||||
private final long firstRequest;
|
||||
|
||||
private boolean terminated;
|
||||
|
@ -155,12 +157,12 @@ class XmrTxProofRequest implements AssetTxProofRequest<XmrTxProofRequest.Result>
|
|||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XmrTxProofRequest(AssetTxProofHttpClient httpClient,
|
||||
XmrTxProofRequest(Socks5ProxyProvider socks5ProxyProvider,
|
||||
XmrTxProofModel model) {
|
||||
this.httpClient = httpClient;
|
||||
this.parser = new XmrTxProofParser();
|
||||
this.model = model;
|
||||
|
||||
httpClient = new XmrTxProofHttpClient(socks5ProxyProvider);
|
||||
httpClient.setBaseUrl("http://" + model.getServiceAddress());
|
||||
if (model.getServiceAddress().matches("^192.*|^localhost.*")) {
|
||||
log.info("Ignoring Socks5 proxy for local net address: {}", model.getServiceAddress());
|
||||
|
|
|
@ -22,11 +22,12 @@ import bisq.core.support.dispute.Dispute;
|
|||
import bisq.core.support.dispute.mediation.MediationManager;
|
||||
import bisq.core.support.dispute.refund.RefundManager;
|
||||
import bisq.core.trade.Trade;
|
||||
import bisq.core.trade.txproof.AssetTxProofHttpClient;
|
||||
import bisq.core.trade.txproof.AssetTxProofRequestsPerTrade;
|
||||
import bisq.core.trade.txproof.AssetTxProofResult;
|
||||
import bisq.core.user.AutoConfirmSettings;
|
||||
|
||||
import bisq.network.Socks5ProxyProvider;
|
||||
|
||||
import bisq.common.handlers.FaultHandler;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -54,7 +55,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
private final AutoConfirmSettings autoConfirmSettings;
|
||||
private final MediationManager mediationManager;
|
||||
private final RefundManager refundManager;
|
||||
private final AssetTxProofHttpClient httpClient;
|
||||
private final Socks5ProxyProvider socks5ProxyProvider;
|
||||
|
||||
private int numRequiredSuccessResults;
|
||||
private final Set<XmrTxProofRequest> requests = new HashSet<>();
|
||||
|
@ -69,12 +70,12 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XmrTxProofRequestsPerTrade(AssetTxProofHttpClient httpClient,
|
||||
XmrTxProofRequestsPerTrade(Socks5ProxyProvider socks5ProxyProvider,
|
||||
Trade trade,
|
||||
AutoConfirmSettings autoConfirmSettings,
|
||||
MediationManager mediationManager,
|
||||
RefundManager refundManager) {
|
||||
this.httpClient = httpClient;
|
||||
this.socks5ProxyProvider = socks5ProxyProvider;
|
||||
this.trade = trade;
|
||||
this.autoConfirmSettings = autoConfirmSettings;
|
||||
this.mediationManager = mediationManager;
|
||||
|
@ -140,7 +141,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
|
||||
for (String serviceAddress : serviceAddresses) {
|
||||
XmrTxProofModel model = new XmrTxProofModel(trade, serviceAddress, autoConfirmSettings);
|
||||
XmrTxProofRequest request = new XmrTxProofRequest(httpClient, model);
|
||||
XmrTxProofRequest request = new XmrTxProofRequest(socks5ProxyProvider, model);
|
||||
|
||||
log.info("{} created", request);
|
||||
requests.add(request);
|
||||
|
|
|
@ -27,12 +27,12 @@ import bisq.core.trade.Trade;
|
|||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.trade.closed.ClosedTradableManager;
|
||||
import bisq.core.trade.failed.FailedTradesManager;
|
||||
import bisq.core.trade.txproof.AssetTxProofHttpClient;
|
||||
import bisq.core.trade.txproof.AssetTxProofResult;
|
||||
import bisq.core.trade.txproof.AssetTxProofService;
|
||||
import bisq.core.user.AutoConfirmSettings;
|
||||
import bisq.core.user.Preferences;
|
||||
|
||||
import bisq.network.Socks5ProxyProvider;
|
||||
import bisq.network.p2p.BootstrapListener;
|
||||
import bisq.network.p2p.P2PService;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
private final RefundManager refundManager;
|
||||
private final P2PService p2PService;
|
||||
private final WalletsSetup walletsSetup;
|
||||
private final AssetTxProofHttpClient httpClient;
|
||||
private final Socks5ProxyProvider socks5ProxyProvider;
|
||||
private final Map<String, XmrTxProofRequestsPerTrade> servicesByTradeId = new HashMap<>();
|
||||
private AutoConfirmSettings autoConfirmSettings;
|
||||
private Map<String, ChangeListener<Trade.State>> tradeStateListenerMap = new HashMap<>();
|
||||
|
@ -101,7 +101,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
RefundManager refundManager,
|
||||
P2PService p2PService,
|
||||
WalletsSetup walletsSetup,
|
||||
AssetTxProofHttpClient httpClient) {
|
||||
Socks5ProxyProvider socks5ProxyProvider) {
|
||||
this.filterManager = filterManager;
|
||||
this.preferences = preferences;
|
||||
this.tradeManager = tradeManager;
|
||||
|
@ -111,7 +111,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
this.refundManager = refundManager;
|
||||
this.p2PService = p2PService;
|
||||
this.walletsSetup = walletsSetup;
|
||||
this.httpClient = httpClient;
|
||||
this.socks5ProxyProvider = socks5ProxyProvider;
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
}
|
||||
|
||||
private void startRequests(SellerTrade trade) {
|
||||
XmrTxProofRequestsPerTrade service = new XmrTxProofRequestsPerTrade(httpClient,
|
||||
XmrTxProofRequestsPerTrade service = new XmrTxProofRequestsPerTrade(socks5ProxyProvider,
|
||||
trade,
|
||||
autoConfirmSettings,
|
||||
mediationManager,
|
||||
|
|
Loading…
Add table
Reference in a new issue