From c7751ee158196af1eca54fa4ce86c4b0775e5065 Mon Sep 17 00:00:00 2001 From: jwilson Date: Fri, 1 Feb 2013 11:00:38 -0500 Subject: [PATCH] Increase the stream drain timeout from 30ms to 100ms. We were missing out on opportunities to reuse HTTPS connections with the previous timeout. This even occured on unit tests where the latency should be very low. https://github.com/square/okhttp/issues/90 --- .../com/squareup/okhttp/internal/http/HttpTransport.java | 2 +- .../squareup/okhttp/internal/http/URLConnectionTest.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/squareup/okhttp/internal/http/HttpTransport.java b/src/main/java/com/squareup/okhttp/internal/http/HttpTransport.java index 37edf744c..943567da9 100644 --- a/src/main/java/com/squareup/okhttp/internal/http/HttpTransport.java +++ b/src/main/java/com/squareup/okhttp/internal/http/HttpTransport.java @@ -43,7 +43,7 @@ public final class HttpTransport implements Transport { * used for connection reuse, this timeout should be significantly less than * the time it takes to establish a new connection. */ - private static final int DISCARD_STREAM_TIMEOUT_MILLIS = 30; + private static final int DISCARD_STREAM_TIMEOUT_MILLIS = 100; public static final int DEFAULT_CHUNK_LENGTH = 1024; diff --git a/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java b/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java index 8be5edb06..6e789e3d2 100644 --- a/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java +++ b/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java @@ -393,11 +393,7 @@ public final class URLConnectionTest { testServerClosesOutput(SHUTDOWN_INPUT_AT_END); } - /** - * Ignored because this test is racy. - * https://github.com/square/okhttp/issues/90 - */ - @Test @Ignore public void serverShutdownOutput() throws Exception { + @Test public void serverShutdownOutput() throws Exception { testServerClosesOutput(SHUTDOWN_OUTPUT_AT_END); }