Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions okgo/src/main/java/com/lzy/okgo/OkGo.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private OkGo() {
builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.callTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);

HttpsUtils.SSLParams sslParams = HttpsUtils.getSslSocketFactory();
builder.sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ public void onFailure(okhttp3.Call call, IOException e) {
if (!call.isCanceled()) {
Response<T> error = Response.error(false, call, null, e);
onError(error);
} else {
// 这个 `else` 是为了解决 callTimeout 无法触发 onError 回调
if (e instanceof InterruptedIOException) {
Response<T> error = Response.error(false, call, null, e);
onError(error);
}
}
}
}
Expand Down