Updated client with more specific details when it cannot connect.
This commit is contained in:
parent
891d96f716
commit
891f8ac25d
@ -136,7 +136,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
|
|||||||
if (options.localChannelName != null && options.tcpPort < 0 && options.udpPort < 0 && options.udtPort < 0) {
|
if (options.localChannelName != null && options.tcpPort < 0 && options.udpPort < 0 && options.udtPort < 0) {
|
||||||
// no networked bootstraps. LOCAL connection only
|
// no networked bootstraps. LOCAL connection only
|
||||||
Bootstrap localBootstrap = new Bootstrap();
|
Bootstrap localBootstrap = new Bootstrap();
|
||||||
this.bootstraps.add(new BootstrapWrapper("LOCAL", -1, localBootstrap));
|
this.bootstraps.add(new BootstrapWrapper("LOCAL", options.localChannelName, -1, localBootstrap));
|
||||||
|
|
||||||
EventLoopGroup localBoss = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-LOCAL",
|
EventLoopGroup localBoss = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-LOCAL",
|
||||||
threadGroup));
|
threadGroup));
|
||||||
@ -159,7 +159,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
|
|||||||
|
|
||||||
if (options.tcpPort > 0) {
|
if (options.tcpPort > 0) {
|
||||||
Bootstrap tcpBootstrap = new Bootstrap();
|
Bootstrap tcpBootstrap = new Bootstrap();
|
||||||
this.bootstraps.add(new BootstrapWrapper("TCP", options.tcpPort, tcpBootstrap));
|
this.bootstraps.add(new BootstrapWrapper("TCP", options.host, options.tcpPort, tcpBootstrap));
|
||||||
|
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
// android ONLY supports OIO (not NIO)
|
// android ONLY supports OIO (not NIO)
|
||||||
@ -189,7 +189,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
|
|||||||
|
|
||||||
if (options.udpPort > 0) {
|
if (options.udpPort > 0) {
|
||||||
Bootstrap udpBootstrap = new Bootstrap();
|
Bootstrap udpBootstrap = new Bootstrap();
|
||||||
this.bootstraps.add(new BootstrapWrapper("UDP", options.udpPort, udpBootstrap));
|
this.bootstraps.add(new BootstrapWrapper("UDP", options.host, options.udpPort, udpBootstrap));
|
||||||
|
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
// android ONLY supports OIO (not NIO)
|
// android ONLY supports OIO (not NIO)
|
||||||
@ -237,7 +237,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
|
|||||||
if (udtAvailable) {
|
if (udtAvailable) {
|
||||||
// all of this must be proxied to another class, so THIS class doesn't have unmet dependencies.
|
// all of this must be proxied to another class, so THIS class doesn't have unmet dependencies.
|
||||||
Bootstrap udtBootstrap = new Bootstrap();
|
Bootstrap udtBootstrap = new Bootstrap();
|
||||||
this.bootstraps.add(new BootstrapWrapper("UDT", options.udtPort, udtBootstrap));
|
this.bootstraps.add(new BootstrapWrapper("UDT", options.host, options.udtPort, udtBootstrap));
|
||||||
|
|
||||||
EventLoopGroup udtBoss = UdtEndpointProxy.getWorker(DEFAULT_THREAD_POOL_SIZE, threadName, threadGroup);
|
EventLoopGroup udtBoss = UdtEndpointProxy.getWorker(DEFAULT_THREAD_POOL_SIZE, threadName, threadGroup);
|
||||||
|
|
||||||
|
@ -21,11 +21,13 @@ public
|
|||||||
class BootstrapWrapper {
|
class BootstrapWrapper {
|
||||||
public final String type;
|
public final String type;
|
||||||
public final Bootstrap bootstrap;
|
public final Bootstrap bootstrap;
|
||||||
|
public final String address;
|
||||||
public final int port;
|
public final int port;
|
||||||
|
|
||||||
public
|
public
|
||||||
BootstrapWrapper(String type, int port, Bootstrap bootstrap) {
|
BootstrapWrapper(String type, String address, int port, Bootstrap bootstrap) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.address = address;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.bootstrap = bootstrap;
|
this.bootstrap = bootstrap;
|
||||||
}
|
}
|
||||||
@ -33,6 +35,6 @@ class BootstrapWrapper {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
String toString() {
|
String toString() {
|
||||||
return "BootstrapWrapper [type=" + this.type + ", port=" + this.port + "]";
|
return "BootstrapWrapper{" + "type='" + type + '\'' + ", address='" + address + '\'' + ", port=" + port + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,16 +86,16 @@ class EndPointClient<C extends Connection> extends EndPoint<C> implements Runnab
|
|||||||
future.await();
|
future.await();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String errorMessage = stopWithErrorMessage(logger2,
|
String errorMessage = stopWithErrorMessage(logger2,
|
||||||
"Could not connect to the " + bootstrapWrapper.type + " server on port: " +
|
"Could not connect to the " + bootstrapWrapper.type + " server at " +
|
||||||
bootstrapWrapper.port,
|
bootstrapWrapper.address + " on port: " + bootstrapWrapper.port,
|
||||||
e);
|
e);
|
||||||
throw new IllegalArgumentException(errorMessage);
|
throw new IllegalArgumentException(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!future.isSuccess()) {
|
if (!future.isSuccess()) {
|
||||||
String errorMessage = stopWithErrorMessage(logger2,
|
String errorMessage = stopWithErrorMessage(logger2,
|
||||||
"Could not connect to the " + bootstrapWrapper.type + " server on port: " +
|
"Could not connect to the " + bootstrapWrapper.type + " server at " +
|
||||||
bootstrapWrapper.port,
|
bootstrapWrapper.address + " on port: " + bootstrapWrapper.port,
|
||||||
future.cause());
|
future.cause());
|
||||||
throw new IllegalArgumentException(errorMessage);
|
throw new IllegalArgumentException(errorMessage);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user