in imagepipeline/src/main/java/com/facebook/imagepipeline/producers/PriorityNetworkFetcher.java [620:662]
public static boolean shouldRetry(
Throwable e,
int attemptNumber,
int maxConnectAttemptCount,
int maxAttemptCount,
boolean retryLowPriAll,
boolean retryLowPriUnknownHostException,
boolean retryLowPriConnectionException,
Priority priority) {
if (e instanceof ConnectException && attemptNumber >= maxConnectAttemptCount) {
return false;
}
if (attemptNumber >= maxAttemptCount) {
return false;
}
boolean isHiPriority = priority == Priority.HIGH;
if (!retryLowPriAll && !isHiPriority) {
return shouldRetryLowPrioritySpecificExceptions(
e, retryLowPriUnknownHostException, retryLowPriConnectionException);
}
if (isHiPriority && e instanceof NonrecoverableException) {
return true;
}
if (e instanceof SocketTimeoutException
|| e instanceof UnknownHostException
|| e instanceof ConnectException
|| e instanceof RetriableIOException) {
return true;
}
String msg = e.getMessage();
if (msg == null) {
return false;
}
return (e instanceof IOException && msg.contains("Canceled"))
|| (e instanceof IOException && msg.contains("unexpected end of stream on null"))
|| (e instanceof SocketException && msg.contains("Socket closed"))
|| (isHiPriority && e instanceof InterruptedIOException && msg.contains("timeout"));
}