diff options
| author | 2010-12-06 16:44:50 -0800 | |
|---|---|---|
| committer | 2010-12-06 16:44:50 -0800 | |
| commit | 4c240a2cd16962016b81081777d5b15c573fa59c (patch) | |
| tree | fa9e42df1f4934e9e2ae195cb2bec8f4e1afa130 | |
| parent | 03b758ef991a483eb9fee705aa0dacdf91a57dd1 (diff) | |
| parent | 465e88eb008408d4e655ca7bdd9c2b3ac305e54b (diff) | |
am 465e88eb: am 1ee2394e: am 1d67fa5b: Merge "Changing connect and response timeout."
* commit '465e88eb008408d4e655ca7bdd9c2b3ac305e54b':
Changing connect and response timeout.
| -rw-r--r-- | core/java/android/net/http/AndroidHttpClient.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/net/http/AndroidHttpClient.java b/core/java/android/net/http/AndroidHttpClient.java index 915e342b0f29..641a576edd45 100644 --- a/core/java/android/net/http/AndroidHttpClient.java +++ b/core/java/android/net/http/AndroidHttpClient.java @@ -80,6 +80,9 @@ public final class AndroidHttpClient implements HttpClient { // Gzip of data shorter than this probably won't be worthwhile public static long DEFAULT_SYNC_MIN_GZIP_BYTES = 256; + // Default connection and socket timeout of 60 seconds. Tweak to taste. + private static final int SOCKET_OPERATION_TIMEOUT = 60 * 1000; + private static final String TAG = "AndroidHttpClient"; private static String[] textContentTypes = new String[] { @@ -113,9 +116,8 @@ public final class AndroidHttpClient implements HttpClient { // and it's not worth it to pay the penalty of checking every time. HttpConnectionParams.setStaleCheckingEnabled(params, false); - // Default connection and socket timeout of 20 seconds. Tweak to taste. - HttpConnectionParams.setConnectionTimeout(params, 20 * 1000); - HttpConnectionParams.setSoTimeout(params, 20 * 1000); + HttpConnectionParams.setConnectionTimeout(params, SOCKET_OPERATION_TIMEOUT); + HttpConnectionParams.setSoTimeout(params, SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSocketBufferSize(params, 8192); // Don't handle redirects -- return them to the caller. Our code @@ -131,7 +133,8 @@ public final class AndroidHttpClient implements HttpClient { schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", - SSLCertificateSocketFactory.getHttpSocketFactory(30 * 1000, sessionCache), 443)); + SSLCertificateSocketFactory.getHttpSocketFactory( + SOCKET_OPERATION_TIMEOUT, sessionCache), 443)); ClientConnectionManager manager = new ThreadSafeClientConnManager(params, schemeRegistry); |