aboutsummaryrefslogtreecommitdiffstats
path: root/okhttp
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-07-29 13:31:58 +0100
committerNarayan Kamath <narayan@google.com>2015-07-30 11:12:01 +0100
commitdd172a128a51cd6b5695e453c688aa7df4861bf0 (patch)
tree76a8b9e04f451a52bc44f9522efb8352c81a0085 /okhttp
parentdf2c498a3d4dc641c7b609873adf905848ace382 (diff)
downloadandroid_external_okhttp-dd172a128a51cd6b5695e453c688aa7df4861bf0.tar.gz
android_external_okhttp-dd172a128a51cd6b5695e453c688aa7df4861bf0.tar.bz2
android_external_okhttp-dd172a128a51cd6b5695e453c688aa7df4861bf0.zip
Allow HttpEngine to retry connections on timeout / interruption.
This reverts behaviour introduced in 60f5406dcc094d043 where HttpEngine doesn't attempt to recover connections on timeout / interruption. This new behaviour introduced regressions on some devices where we're handed a mixture of IPV4 / IPV6 routes but where only one aspect of the network (either IPV4 or 6) is functional. bug: 22779586 (cherry picked from commit 34d6cda57322deb57ccbf57357c084772782375e) Change-Id: I1036e4c1dbb29e72c0d07a491d49677936f3f154
Diffstat (limited to 'okhttp')
-rw-r--r--okhttp/src/main/java/com/squareup/okhttp/internal/ConnectionSpecSelector.java6
-rw-r--r--okhttp/src/main/java/com/squareup/okhttp/internal/http/HttpEngine.java5
2 files changed, 6 insertions, 5 deletions
diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/ConnectionSpecSelector.java b/okhttp/src/main/java/com/squareup/okhttp/internal/ConnectionSpecSelector.java
index dabe8b2..ac9de11 100644
--- a/okhttp/src/main/java/com/squareup/okhttp/internal/ConnectionSpecSelector.java
+++ b/okhttp/src/main/java/com/squareup/okhttp/internal/ConnectionSpecSelector.java
@@ -99,6 +99,12 @@ public final class ConnectionSpecSelector {
}
// If there was an interruption or timeout, don't recover.
+ //
+ // NOTE: This code (unlike the rest of this method) is not shared with HttpEngine.
+ // In HttpEngine, we would like to retry if we see an interruption or timeout because
+ // we might potentially be connecting to a different address family (IPV4 vs IPV6, say).
+ // That consideration is not relevant here, since the SocketConnector will always connect
+ // via the same Route even if the connection failed.
if (e instanceof InterruptedIOException) {
return false;
}
diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/http/HttpEngine.java b/okhttp/src/main/java/com/squareup/okhttp/internal/http/HttpEngine.java
index 0fdce80..0b6af86 100644
--- a/okhttp/src/main/java/com/squareup/okhttp/internal/http/HttpEngine.java
+++ b/okhttp/src/main/java/com/squareup/okhttp/internal/http/HttpEngine.java
@@ -449,11 +449,6 @@ public final class HttpEngine {
return false;
}
- // If there was an interruption or timeout, don't recover.
- if (ioe instanceof InterruptedIOException) {
- return false;
- }
-
// Look for known client-side or negotiation errors that are unlikely to be fixed by trying
// again with a different route.
if (ioe instanceof SSLHandshakeException) {