Don't try to use UnixResolverDnsServerAddressStreamProvider when on Windows.

Motivation:

We should not try to use UnixResolverDnsServerAddressStreamProvider when on Windows as it will log some error that will produce noise and may confuse users.

Modifications:

Just use DefaultDnsServerAddressStreamProvider if windows is used.

Result:

Less noise in the logs. This was reported in vert.x: https://github.com/eclipse/vert.x/issues/2204
This commit is contained in:
Norman Maurer 2017-11-13 13:40:27 +01:00
parent 1f1a60ae7d
commit 0013567cd8

View File

@ -15,6 +15,7 @@
*/
package io.netty.resolver.dns;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.UnstableApi;
/**
@ -25,6 +26,9 @@ public final class DnsServerAddressStreamProviders {
// TODO(scott): how is this done on Windows? This may require a JNI call to GetNetworkParams
// https://msdn.microsoft.com/en-us/library/aa365968(VS.85).aspx.
private static final DnsServerAddressStreamProvider DEFAULT_DNS_SERVER_ADDRESS_STREAM_PROVIDER =
// If on windows just use the DefaultDnsServerAddressStreamProvider.INSTANCE as otherwise
// we will log some error which may be confusing.
PlatformDependent.isWindows() ? DefaultDnsServerAddressStreamProvider.INSTANCE :
UnixResolverDnsServerAddressStreamProvider.parseSilently();
private DnsServerAddressStreamProviders() {