You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2014/05/22 21:13:13 UTC
svn commit: r1596943 - in /httpcomponents/httpcore/branches/4.3.x:
httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java
Author: olegk
Date: Thu May 22 19:13:12 2014
New Revision: 1596943
URL: http://svn.apache.org/r1596943
Log:
Apply initial socket parameters prior to bind operation
Modified:
httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java?rev=1596943&r1=1596942&r2=1596943&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java (original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java Thu May 22 19:13:12 2014
@@ -259,16 +259,17 @@ public class DefaultConnectingIOReactor
throw new IOReactorException("Failure opening socket", ex);
}
try {
- socketChannel.configureBlocking(false);
validateAddress(request.getLocalAddress());
validateAddress(request.getRemoteAddress());
+ socketChannel.configureBlocking(false);
+ prepareSocket(socketChannel.socket());
+
if (request.getLocalAddress() != null) {
final Socket sock = socketChannel.socket();
sock.setReuseAddress(this.config.isSoReuseAddress());
sock.bind(request.getLocalAddress());
}
- prepareSocket(socketChannel.socket());
final boolean connected = socketChannel.connect(request.getRemoteAddress());
if (connected) {
final ChannelEntry entry = new ChannelEntry(socketChannel, request);
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java?rev=1596943&r1=1596942&r2=1596943&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java (original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java Thu May 22 19:13:12 2014
@@ -164,13 +164,13 @@ public class BasicConnFactory implements
}
}
socket.setSoTimeout(this.sconfig.getSoTimeout());
- socket.connect(new InetSocketAddress(hostname, port), this.connectTimeout);
socket.setTcpNoDelay(this.sconfig.isTcpNoDelay());
final int linger = this.sconfig.getSoLinger();
if (linger >= 0) {
socket.setSoLinger(linger > 0, linger);
}
socket.setKeepAlive(this.sconfig.isSoKeepAlive());
+ socket.connect(new InetSocketAddress(hostname, port), this.connectTimeout);
return this.connFactory.createConnection(socket);
}