mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
NetClient and HttpClient should return a failed future instead of throwing an exception when the transport cannot create a domain socket.
This commit is contained in:
@@ -114,7 +114,6 @@ class HttpChannelConnector implements ConnectionProvider<HttpClientConnection> {
|
||||
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap.group(context.nettyEventLoop());
|
||||
bootstrap.channelFactory(client.getVertx().transport().channelFactory(domainSocket));
|
||||
|
||||
applyConnectionOptions(domainSocket, bootstrap);
|
||||
|
||||
|
||||
@@ -35,7 +35,12 @@ public class AsyncResolveConnectHelper {
|
||||
SocketAddress socketAddress,
|
||||
ServerBootstrap bootstrap) {
|
||||
Promise<Channel> promise = vertx.getAcceptorEventLoopGroup().next().newPromise();
|
||||
bootstrap.channelFactory(vertx.transport().serverChannelFactory(socketAddress.path() != null));
|
||||
try {
|
||||
bootstrap.channelFactory(vertx.transport().serverChannelFactory(socketAddress.path() != null));
|
||||
} catch (Exception e) {
|
||||
promise.setFailure(e);
|
||||
return promise;
|
||||
}
|
||||
if (socketAddress.path() != null) {
|
||||
java.net.SocketAddress converted = vertx.transport().convert(socketAddress, true);
|
||||
ChannelFuture future = bootstrap.bind(converted);
|
||||
|
||||
@@ -77,6 +77,12 @@ public final class ChannelProvider {
|
||||
}
|
||||
|
||||
private void connect(SocketAddress remoteAddress, SocketAddress peerAddress, String serverName, boolean ssl, Promise<Channel> p) {
|
||||
try {
|
||||
bootstrap.channelFactory(context.owner().transport().channelFactory(remoteAddress.path() != null));
|
||||
} catch (Exception e) {
|
||||
p.setFailure(e);
|
||||
return;
|
||||
}
|
||||
if (proxyOptions != null) {
|
||||
handleProxyConnect(remoteAddress, peerAddress, serverName, ssl, p);
|
||||
} else {
|
||||
|
||||
@@ -197,7 +197,6 @@ public class NetClientImpl implements MetricsProvider, NetClient {
|
||||
sslHelper.validate(vertx);
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap.group(context.nettyEventLoop());
|
||||
bootstrap.channelFactory(vertx.transport().channelFactory(remoteAddress.path() != null));
|
||||
|
||||
applyConnectionOptions(remoteAddress.path() != null, bootstrap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user