From 236c7c824668cb2f9c79d4e5595c2b821422fe4e Mon Sep 17 00:00:00 2001 From: Matt VanderKolk Date: Thu, 28 Jul 2022 14:36:39 -0700 Subject: [PATCH] Re-classifying NO_NETWORK to be only UnknownHostException on Android (#709) * Re-classifying NO_NETWORK to be only UnknownHostException At some point recently various socket exceptions started getting classified as "isNoNetworkFailure". While this was intended to be helpful classification, the resulting behavior is that on a socket exception, retry logic will not get engaged. This is because retry logic does not attempt to retry if there is no network in order to save from repeatedly waiting when there isn't a reason to wait. This behavior change was not good or intended so I am reverting it. --- .../main/java/com/xbox/httpclient/HttpClientRequest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Build/libHttpClient.Android/src/main/java/com/xbox/httpclient/HttpClientRequest.java b/Build/libHttpClient.Android/src/main/java/com/xbox/httpclient/HttpClientRequest.java index 9893f5e1..90036d0b 100644 --- a/Build/libHttpClient.Android/src/main/java/com/xbox/httpclient/HttpClientRequest.java +++ b/Build/libHttpClient.Android/src/main/java/com/xbox/httpclient/HttpClientRequest.java @@ -67,10 +67,10 @@ public class HttpClientRequest { OK_CLIENT.newCall(this.requestBuilder.build()).enqueue(new Callback() { @Override public void onFailure(final Call call, IOException e) { - boolean isNoNetworkFailure = - e instanceof UnknownHostException || - e instanceof ConnectException || - e instanceof SocketTimeoutException; + // isNoNetworkFailure indicates to the native code when to assume the client is + // disconnected from the internet. In no network cases, retry logic will not be + // activated. + boolean isNoNetworkFailure = e instanceof UnknownHostException; StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw);