summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-02-26 07:55:54 -0800
committerKenny Root <kroot@google.com>2010-02-26 07:55:54 -0800
commit07b7bb333f41e90af0a72a462fed847378641d21 (patch)
tree1cb8abc888170f4864a238bb260034859950fd01 /src/org
parentceab342827538782a715a10e5030a222700895ce (diff)
downloadexternal_apache-http-07b7bb333f41e90af0a72a462fed847378641d21.zip
external_apache-http-07b7bb333f41e90af0a72a462fed847378641d21.tar.gz
external_apache-http-07b7bb333f41e90af0a72a462fed847378641d21.tar.bz2
Revert "Implement proper multihoming support, so if one server fails for whatever reason"
This reverts commit ceab342827538782a715a10e5030a222700895ce.
Diffstat (limited to 'src/org')
-rw-r--r--src/org/apache/http/conn/scheme/PlainSocketFactory.java10
-rw-r--r--src/org/apache/http/impl/conn/DefaultClientConnectionOperator.java40
2 files changed, 16 insertions, 34 deletions
diff --git a/src/org/apache/http/conn/scheme/PlainSocketFactory.java b/src/org/apache/http/conn/scheme/PlainSocketFactory.java
index b15df44..acc13f7 100644
--- a/src/org/apache/http/conn/scheme/PlainSocketFactory.java
+++ b/src/org/apache/http/conn/scheme/PlainSocketFactory.java
@@ -35,9 +35,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
-import java.net.SocketTimeoutException;
-import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
@@ -115,11 +113,9 @@ public final class PlainSocketFactory implements SocketFactory {
} else {
remoteAddress = new InetSocketAddress(host, port);
}
- try {
- sock.connect(remoteAddress, timeout);
- } catch (SocketTimeoutException ex) {
- throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
- }
+
+ sock.connect(remoteAddress, timeout);
+
return sock;
} // connectSocket
diff --git a/src/org/apache/http/impl/conn/DefaultClientConnectionOperator.java b/src/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
index 0fc1725..41488e1 100644
--- a/src/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
+++ b/src/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
@@ -44,7 +44,6 @@ import org.apache.http.protocol.HttpContext;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.conn.ClientConnectionOperator;
-import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.scheme.LayeredSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
@@ -122,33 +121,19 @@ public class DefaultClientConnectionOperator
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
final SocketFactory sf = schm.getSocketFactory();
- InetAddress[] addresses = InetAddress.getAllByName(target.getHostName());
-
- for (int i = 0; i < addresses.length; ++i) {
- Socket sock = sf.createSocket();
- conn.opening(sock, target);
-
- try {
- Socket connsock = sf.connectSocket(sock, addresses[i].getHostAddress(),
- schm.resolvePort(target.getPort()),
- local, 0, params);
- if (sock != connsock) {
- sock = connsock;
- conn.opening(sock, target);
- }
- prepareSocket(sock, context, params);
- conn.openCompleted(sf.isSecure(sock), params);
- break;
- } catch (ConnectException ex) {
- if (i == addresses.length - 1) {
- throw new HttpHostConnectException(target, ex);
- }
- } catch (ConnectTimeoutException ex) {
- if (i == addresses.length - 1) {
- throw ex;
- }
- }
+
+ Socket sock = sf.createSocket();
+ conn.opening(sock, target);
+
+ try {
+ sock = sf.connectSocket(sock, target.getHostName(),
+ schm.resolvePort(target.getPort()),
+ local, 0, params);
+ } catch (ConnectException ex) {
+ throw new HttpHostConnectException(target, ex);
}
+ prepareSocket(sock, context, params);
+ conn.openCompleted(sf.isSecure(sock), params);
} // openConnection
@@ -228,3 +213,4 @@ public class DefaultClientConnectionOperator
} // class DefaultClientConnectionOperator
+