[Bug 358147] Add catch for UnknownHostException to fix leaky file descriptor in client

This commit is contained in:
Jesse McConnell 2011-09-20 14:26:17 -05:00
parent 4b7f8d79dd
commit 21ddd768f0
1 changed files with 9 additions and 2 deletions

View File

@ -15,6 +15,7 @@ package org.eclipse.jetty.client;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
@ -110,11 +111,17 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector
{
channel.connect(address.toSocketAddress());
}
catch (UnresolvedAddressException ex)
catch (UnresolvedAddressException uae)
{
channel.close();
throw ex;
throw uae;
}
catch ( UnknownHostException uhe )
{
channel.close();
throw uhe;
}
_selectorManager.register(channel,destination);
ConnectTimeout connectTimeout = new ConnectTimeout(channel,destination);
_httpClient.schedule(connectTimeout,_httpClient.getConnectTimeout());