aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2011-09-20 04:20:24 (EDT)
committerJesse McConnell2011-09-20 15:21:26 (EDT)
commit4b7f8d79dd9465b561599e1635bb86f08d99d14b (patch)
tree089b098b65f1c5ddcc0365f99ac4b2cb16f0d9a3
parentf0fe55165b6ff36c9440d3ba4272f64ebd232b10 (diff)
downloadorg.eclipse.jetty.project-4b7f8d79dd9465b561599e1635bb86f08d99d14b.zip
org.eclipse.jetty.project-4b7f8d79dd9465b561599e1635bb86f08d99d14b.tar.gz
org.eclipse.jetty.project-4b7f8d79dd9465b561599e1635bb86f08d99d14b.tar.bz2
358147: SelectConnector catch UnresolvedAddressException to avoid socket leak
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
index f070951..caadb23 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
@@ -17,8 +17,10 @@ import java.io.IOException;
import java.net.SocketTimeoutException;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
+import java.nio.channels.UnresolvedAddressException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
@@ -104,7 +106,15 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector
else
{
channel.configureBlocking(false);
- channel.connect(address.toSocketAddress());
+ try
+ {
+ channel.connect(address.toSocketAddress());
+ }
+ catch (UnresolvedAddressException ex)
+ {
+ channel.close();
+ throw ex;
+ }
_selectorManager.register(channel,destination);
ConnectTimeout connectTimeout = new ConnectTimeout(channel,destination);
_httpClient.schedule(connectTimeout,_httpClient.getConnectTimeout());