mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-02 03:36:24 -04:00
cancel pending price request on select new provider
This commit is contained in:
parent
75e85179b4
commit
7beae49dd2
3 changed files with 29 additions and 7 deletions
|
@ -39,5 +39,7 @@ public interface HttpClient {
|
|||
|
||||
boolean hasPendingRequest();
|
||||
|
||||
void cancelPendingRequest();
|
||||
|
||||
void shutDown();
|
||||
}
|
||||
|
|
|
@ -135,6 +135,24 @@ public class HttpClientImpl implements HttpClient {
|
|||
}
|
||||
}
|
||||
|
||||
public void cancelPendingRequest() {
|
||||
if (!hasPendingRequest) return;
|
||||
try {
|
||||
if (connection != null) {
|
||||
connection.getInputStream().close();
|
||||
connection.disconnect();
|
||||
connection = null;
|
||||
}
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
closeableHttpClient = null;
|
||||
}
|
||||
} catch (IOException err) {
|
||||
// igbnore
|
||||
}
|
||||
hasPendingRequest = false;
|
||||
}
|
||||
|
||||
private String requestWithoutProxy(String baseUrl,
|
||||
String param,
|
||||
HttpMethod httpMethod,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue