diff options
author | cyBerta <cyberta@riseup.net> | 2021-02-18 13:31:58 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-02-18 13:31:58 +0100 |
commit | f492851c35a621c8d23a86d7c9cd17a760f50915 (patch) | |
tree | f2668e385eff5ca2d63d4e80aa61ed765efa0114 /app/src/main | |
parent | 4b916a189f2f88425ebf5d09bb6b7ba3568836e1 (diff) |
add logging in ProvderApiConnector, in order to see the failing requests
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java index ba902566..c863abd4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Locale; import java.util.Scanner; +import de.blinkt.openvpn.core.VpnStatus; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -68,6 +69,9 @@ public class ProviderApiConnector { Request request = requestBuilder.build(); Response response = okHttpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + VpnStatus.logWarning("[API] API request failed canConnect(): " + url); + } return response.isSuccessful(); } @@ -88,6 +92,9 @@ public class ProviderApiConnector { Request request = requestBuilder.build(); Response response = okHttpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + VpnStatus.logWarning("[API] API request failed: " + url); + } InputStream inputStream = response.body().byteStream(); Scanner scanner = new Scanner(inputStream).useDelimiter("\\A"); if (scanner.hasNext()) { |