private boolean isRecoverable(IOException e, boolean requestSendStarted) {
....
// If there was an interruption don't recover, but if there was a
//timeout connecting to a route
// we should try the next route (if there is one).
if (e instanceof InterruptedIOException) {
return e instanceof SocketTimeoutException && !requestSendStarted;
}
....
return true;
}
코드 예는 RetryAndFollowUpInterceptor이고 OKHttp
입니다.SocketTimeoutException이 발생했을 때 OKHttp가 다시 시도되지 않도록 설계된 이유
내 질문에 및 requestSendStarted == true 일 때 OkHttp
이 다시 시도하지 않는 이유는 무엇입니까?
내가 다른 라우터가있는 경우, 우리는 목표는 OkHttp 전혀 연결할 수없는 경우 재 시도했다
제게는 의미가 있습니다. 따라서 사용자가 다시 시도하기를 원할 경우 OKHttp Source를 수정하거나 이런 종류의 Exceptions를 catch하고 사용자 정의 인터셉터에서 어떤 작업을 수행 할 수 있습니까? – cafecat
예, 인터셉터에서 예외를 catch하고 다시 시도 할 수 있습니다. –