aboutsummaryrefslogtreecommitdiffstats
path: root/okhttp
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-05-27 10:50:24 +0100
committerNeil Fuller <nfuller@google.com>2015-06-11 14:03:51 +0100
commitba6e9e96cd027a16f5f555966f332f8799da8b74 (patch)
treedc6bf5e51417305ba52c9c39a568084310743500 /okhttp
parente9689138ba98723f93ddf1bc74bbf66d332dfd76 (diff)
downloadandroid_external_okhttp-ba6e9e96cd027a16f5f555966f332f8799da8b74.tar.gz
android_external_okhttp-ba6e9e96cd027a16f5f555966f332f8799da8b74.tar.bz2
android_external_okhttp-ba6e9e96cd027a16f5f555966f332f8799da8b74.zip
Fix for HttpURLConnection not always throwing SocketTimeoutException
Contains upstream changes: Okio: https://github.com/square/okio/pull/154 OkHttp: https://github.com/square/okhttp/pull/1698 (pending) Bug: 21396523 (cherry-picked from commit b5f9076b16fcc41c3dad31aecfdcfd962a7a1f75) Change-Id: I4d44e973f906d41a622598e2293d4026fc1ed039
Diffstat (limited to 'okhttp')
-rw-r--r--okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java b/okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java
index 05ce57a..cdbd7aa 100644
--- a/okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java
+++ b/okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java
@@ -19,6 +19,7 @@ package com.squareup.okhttp.internal.spdy;
import java.io.EOFException;
import java.io.IOException;
import java.io.InterruptedIOException;
+import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
import okio.AsyncTimeout;
@@ -600,8 +601,16 @@ public final class SpdyStream {
closeLater(ErrorCode.CANCEL);
}
- public void exitAndThrowIfTimedOut() throws InterruptedIOException {
- if (exit()) throw new InterruptedIOException("timeout");
+ @Override protected IOException newTimeoutException(IOException cause) {
+ SocketTimeoutException socketTimeoutException = new SocketTimeoutException("timeout");
+ if (cause != null) {
+ socketTimeoutException.initCause(cause);
+ }
+ return socketTimeoutException;
+ }
+
+ public void exitAndThrowIfTimedOut() throws IOException {
+ if (exit()) throw newTimeoutException(null /* cause */);
}
}
}