Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Add asynchronous DNS resolution.
Dieser Commit ist enthalten in:
Ursprung
e71bac2028
Commit
4a872ffabe
@ -33,6 +33,7 @@ dependencies {
|
||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
||||
compile "io.netty:netty-transport-native-kqueue:${nettyVersion}:osx-x86_64"
|
||||
compile "io.netty:netty-resolver-dns:${nettyVersion}"
|
||||
|
||||
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
||||
compile "org.apache.logging.log4j:log4j-core:${log4jVersion}"
|
||||
|
@ -11,6 +11,9 @@ import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider;
|
||||
import io.netty.resolver.dns.DnsAddressResolverGroup;
|
||||
import io.netty.resolver.dns.MultiDnsServerAddressStreamProvider;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -31,6 +34,8 @@ public final class ConnectionManager {
|
||||
private final VelocityServer server;
|
||||
public final ServerChannelInitializerHolder serverChannelInitializer;
|
||||
|
||||
private final DnsAddressResolverGroup resolverGroup;
|
||||
|
||||
public ConnectionManager(VelocityServer server) {
|
||||
this.server = server;
|
||||
this.transportType = TransportType.bestType();
|
||||
@ -38,6 +43,8 @@ public final class ConnectionManager {
|
||||
this.workerGroup = this.transportType.createEventLoopGroup(TransportType.Type.WORKER);
|
||||
this.serverChannelInitializer = new ServerChannelInitializerHolder(
|
||||
new ServerChannelInitializer(this.server));
|
||||
this.resolverGroup = new DnsAddressResolverGroup(this.transportType.datagramChannelClass,
|
||||
DefaultDnsServerAddressStreamProvider.INSTANCE);
|
||||
}
|
||||
|
||||
public void logChannelInformation() {
|
||||
@ -91,7 +98,8 @@ public final class ConnectionManager {
|
||||
.group(this.workerGroup)
|
||||
.option(ChannelOption.TCP_NODELAY, true)
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
|
||||
this.server.getConfiguration().getConnectTimeout());
|
||||
this.server.getConfiguration().getConnectTimeout())
|
||||
.resolver(this.resolverGroup);
|
||||
}
|
||||
|
||||
public void close(InetSocketAddress oldBind) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren