Set TCP nodelay to false for Netty

This commit is contained in:
md_5 2013-04-23 18:44:49 +10:00
parent 57f285be66
commit 57cabfb59d

View File

@ -1,4 +1,4 @@
From f29d525666c67bdc26e351f7dbd17d55a742676f Mon Sep 17 00:00:00 2001 From 1890313f461b35a0e1807543cac1b8881d984827 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:47:32 +1000 Date: Tue, 23 Apr 2013 11:47:32 +1000
Subject: [PATCH] Netty Subject: [PATCH] Netty
@ -695,10 +695,10 @@ index 0000000..0e1b1fd
+} +}
diff --git a/src/main/java/org/spigotmc/netty/NettyServerConnection.java b/src/main/java/org/spigotmc/netty/NettyServerConnection.java diff --git a/src/main/java/org/spigotmc/netty/NettyServerConnection.java b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
new file mode 100644 new file mode 100644
index 0000000..e5d24f7 index 0000000..2a9aa0a
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/netty/NettyServerConnection.java +++ b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
@@ -0,0 +1,90 @@ @@ -0,0 +1,80 @@
+package org.spigotmc.netty; +package org.spigotmc.netty;
+ +
+import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.common.util.concurrent.ThreadFactoryBuilder;
@ -714,17 +714,10 @@ index 0000000..e5d24f7
+import java.net.InetAddress; +import java.net.InetAddress;
+import java.security.GeneralSecurityException; +import java.security.GeneralSecurityException;
+import java.security.Key; +import java.security.Key;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+import javax.crypto.Cipher; +import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.IvParameterSpec;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.PendingConnection;
+import net.minecraft.server.ServerConnection; +import net.minecraft.server.ServerConnection;
+import org.bukkit.Bukkit;
+ +
+/** +/**
+ * This is the NettyServerConnection class. It implements + * This is the NettyServerConnection class. It implements
@ -736,8 +729,6 @@ index 0000000..e5d24f7
+ +
+ private final ChannelFuture socket; + private final ChannelFuture socket;
+ +
+
+
+ public NettyServerConnection(MinecraftServer ms, InetAddress host, int port) { + public NettyServerConnection(MinecraftServer ms, InetAddress host, int port) {
+ super(ms); + super(ms);
+ int threads = Integer.getInteger("org.spigotmc.netty.threads", 3); + int threads = Integer.getInteger("org.spigotmc.netty.threads", 3);
@ -757,11 +748,10 @@ index 0000000..e5d24f7
+ .addLast("encoder", new PacketEncoder(networkManager)) + .addLast("encoder", new PacketEncoder(networkManager))
+ .addLast("manager", networkManager); + .addLast("manager", networkManager);
+ } + }
+ }).group(new NioEventLoopGroup(threads, new ThreadFactoryBuilder().setNameFormat("Netty IO Thread - %1$d").build())).localAddress(host, port).bind(); + }).childOption(ChannelOption.TCP_NODELAY, false).group(new NioEventLoopGroup(threads, new ThreadFactoryBuilder().setNameFormat("Netty IO Thread - %1$d").build())).localAddress(host, port).bind();
+ MinecraftServer.getServer().getLogger().info("Using Netty NIO with " + threads + " threads for network connections."); + MinecraftServer.getServer().getLogger().info("Using Netty NIO with " + threads + " threads for network connections.");
+ } + }
+ +
+
+ /** + /**
+ * Shutdown. This method is called when the server is shutting down and the + * Shutdown. This method is called when the server is shutting down and the
+ * server socket and all clients should be terminated with no further + * server socket and all clients should be terminated with no further