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.
This commit is contained in:
Matt VanderKolk 2022-07-28 14:36:39 -07:00 коммит произвёл GitHub
Родитель d81df0a775
Коммит 236c7c8246
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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);