hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1596951 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
Date Thu, 22 May 2014 19:45:59 GMT
Author: olegk
Date: Thu May 22 19:45:59 2014
New Revision: 1596951

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

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java?rev=1596951&r1=1596950&r2=1596951&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
Thu May 22 19:45:59 2014
@@ -114,7 +114,14 @@ public class DefaultHttpClientConnection
             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(true, linger);
+            }
             conn.bind(sock);
 
             final InetSocketAddress remoteAddress = new InetSocketAddress(address, port);
@@ -122,15 +129,8 @@ public class DefaultHttpClientConnection
                 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(true, linger);
-                }
                 conn.bind(sock);
                 if (this.log.isDebugEnabled()) {
                     this.log.debug("Connection established " + conn);



Mime
View raw message