hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1596950 - /httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
Date Thu, 22 May 2014 19:45:39 GMT
Author: olegk
Date: Thu May 22 19:45:38 2014
New Revision: 1596950

URL: http://svn.apache.org/r1596950
Log:
Apply initial socket parameters prior to bind operation

Modified:
    httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java

Modified: httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java?rev=1596950&r1=1596949&r2=1596950&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
(original)
+++ httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
Thu May 22 19:45:38 2014
@@ -105,7 +105,14 @@ class HttpClientConnectionOperator {
             final boolean last = i == addresses.length - 1;
 
             Socket sock = sf.createSocket(context);
+            sock.setSoTimeout(socketConfig.getSoTimeout());
             sock.setReuseAddress(socketConfig.isSoReuseAddress());
+            sock.setTcpNoDelay(socketConfig.isTcpNoDelay());
+            sock.setKeepAlive(socketConfig.isSoKeepAlive());
+            final int linger = socketConfig.getSoLinger();
+            if (linger >= 0) {
+                sock.setSoLinger(linger > 0, linger);
+            }
             conn.bind(sock);
 
             final InetSocketAddress remoteAddress = new InetSocketAddress(address, port);
@@ -113,15 +120,8 @@ class HttpClientConnectionOperator {
                 this.log.debug("Connecting to " + remoteAddress);
             }
             try {
-                sock.setSoTimeout(socketConfig.getSoTimeout());
                 sock = sf.connectSocket(
                         connectTimeout, sock, host, remoteAddress, localAddress, context);
-                sock.setTcpNoDelay(socketConfig.isTcpNoDelay());
-                sock.setKeepAlive(socketConfig.isSoKeepAlive());
-                final int linger = socketConfig.getSoLinger();
-                if (linger >= 0) {
-                    sock.setSoLinger(linger > 0, linger);
-                }
                 conn.bind(sock);
                 if (this.log.isDebugEnabled()) {
                     this.log.debug("Connection established " + conn);



Mime
View raw message