Formatting, cleaned up logic

This commit is contained in:
nathan 2018-03-02 23:24:10 +01:00
parent e20efc5109
commit 0c887f5524
2 changed files with 8 additions and 8 deletions

View File

@ -170,11 +170,11 @@ class DnsServer extends Shutdownable {
.childHandler(new DnsServerHandler(logger)); .childHandler(new DnsServerHandler(logger));
// have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address! // have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address!
if (hostName != null) { if (hostName.equals("0.0.0.0")) {
tcpBootstrap.localAddress(hostName, tcpPort); tcpBootstrap.localAddress(tcpPort);
} }
else { else {
tcpBootstrap.localAddress(tcpPort); tcpBootstrap.localAddress(hostName, tcpPort);
} }
@ -187,11 +187,11 @@ class DnsServer extends Shutdownable {
// android ONLY supports OIO (not NIO) // android ONLY supports OIO (not NIO)
udpBootstrap.channel(OioDatagramChannel.class); udpBootstrap.channel(OioDatagramChannel.class);
} }
else if (OS.isLinux()) { else if (OS.isLinux() && NativeLibrary.isAvailable()) {
// JNI network stack is MUCH faster (but only on linux) // JNI network stack is MUCH faster (but only on linux)
udpBootstrap.channel(EpollDatagramChannel.class); udpBootstrap.channel(EpollDatagramChannel.class);
} }
else if (OS.isMacOsX()) { else if (OS.isMacOsX() && NativeLibrary.isAvailable()) {
// JNI network stack is MUCH faster (but only on macosx) // JNI network stack is MUCH faster (but only on macosx)
udpBootstrap.channel(KQueueDatagramChannel.class); udpBootstrap.channel(KQueueDatagramChannel.class);
} }

View File

@ -230,11 +230,11 @@ class Server<C extends Connection> extends EndPointServer {
registrationWrapper)); registrationWrapper));
// have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address! // have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address!
if (!hostName.equals("0.0.0.0")) { if (hostName.equals("0.0.0.0")) {
tcpBootstrap.localAddress(hostName, tcpPort); tcpBootstrap.localAddress(tcpPort);
} }
else { else {
tcpBootstrap.localAddress(tcpPort); tcpBootstrap.localAddress(hostName, tcpPort);
} }