diff options
author | Brian Carlstrom <bdc@google.com> | 2010-12-03 09:59:07 -0800 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2010-12-03 09:59:07 -0800 |
commit | f0035c0e7077bc2d7a8aaf6516d96b0d2b1ba22d (patch) | |
tree | b2d1adbee8be1ea7f9dc8637fb559743150b2085 /src | |
parent | bdd331840a37ca37136f6c030ad557750372d53f (diff) | |
download | external_apache-http-f0035c0e7077bc2d7a8aaf6516d96b0d2b1ba22d.zip external_apache-http-f0035c0e7077bc2d7a8aaf6516d96b0d2b1ba22d.tar.gz external_apache-http-f0035c0e7077bc2d7a8aaf6516d96b0d2b1ba22d.tar.bz2 |
Set per request socket timeout on reused connections
Even though SoTimeout, TcpNoDelay, and SoLinger can be specified per
request in HttpParams, these values are only set on the underlying
socket in the DefaultRequestDirector when ManagedClientConnection.open
is called to create a new connection. On reused connection, no setting
of Socket options was being done.
There does not seem to be an easy way to fix this without changing one
or more APIs but for the timeout case at least, we can use the fact
that the ManagedClientConnection is an HttpConnection which has a
setSocketTimeout method.
Bug: 3241899
Change-Id: I080147b017b961502b3ba98d40841fea679491eb
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/http/impl/client/DefaultRequestDirector.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/apache/http/impl/client/DefaultRequestDirector.java b/src/org/apache/http/impl/client/DefaultRequestDirector.java index 511f8a0..6df6246 100644 --- a/src/org/apache/http/impl/client/DefaultRequestDirector.java +++ b/src/org/apache/http/impl/client/DefaultRequestDirector.java @@ -346,7 +346,13 @@ public class DefaultRequestDirector implements RequestDirector { // Reopen connection if needed if (!managedConn.isOpen()) { managedConn.open(route, context, params); - } + } + // BEGIN android-added + else { + // b/3241899 set the per request timeout parameter on reused connections + managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params)); + } + // END android-added try { establishRoute(route, context); |