Give a pot shot at bringing network logic a bit closer to CB/Vanilla

This commit is contained in:
md_5 2013-02-09 21:05:34 +11:00
parent 3302eedef5
commit 5e80c9de0b

View file

@ -1,4 +1,4 @@
From 390fe6af47a05b76129811792a4e16b804b89f37 Mon Sep 17 00:00:00 2001
From b789b1161941b447aea0312f249e3addc123e29c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Feb 2013 10:24:33 +1100
Subject: [PATCH] Netty
@ -16,13 +16,13 @@ This commit is licensed under the Creative Commons Attribution-ShareAlike 3.0 Un
.../java/net/minecraft/server/DedicatedServer.java | 2 +-
.../net/minecraft/server/PendingConnection.java | 11 +-
src/main/java/org/spigotmc/netty/CipherCodec.java | 65 ++++++
.../org/spigotmc/netty/NettyNetworkManager.java | 193 ++++++++++++++++
.../org/spigotmc/netty/NettyNetworkManager.java | 198 ++++++++++++++++
.../org/spigotmc/netty/NettyServerConnection.java | 98 ++++++++
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
.../java/org/spigotmc/netty/PacketDecoder.java | 52 +++++
.../java/org/spigotmc/netty/PacketEncoder.java | 43 ++++
.../java/org/spigotmc/netty/PacketListener.java | 100 +++++++++
10 files changed, 818 insertions(+), 4 deletions(-)
10 files changed, 823 insertions(+), 4 deletions(-)
create mode 100644 src/main/java/org/spigotmc/netty/CipherCodec.java
create mode 100644 src/main/java/org/spigotmc/netty/NettyNetworkManager.java
create mode 100644 src/main/java/org/spigotmc/netty/NettyServerConnection.java
@ -176,10 +176,10 @@ index 0000000..cfc0535
+}
diff --git a/src/main/java/org/spigotmc/netty/NettyNetworkManager.java b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
new file mode 100644
index 0000000..27fd665
index 0000000..e97e77a
--- /dev/null
+++ b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
@@ -0,0 +1,193 @@
@@ -0,0 +1,198 @@
+package org.spigotmc.netty;
+
+import io.netty.channel.Channel;
@ -200,6 +200,7 @@ index 0000000..27fd665
+import net.minecraft.server.Packet;
+import net.minecraft.server.Packet252KeyResponse;
+import net.minecraft.server.PendingConnection;
+import net.minecraft.server.PlayerConnection;
+import org.bouncycastle.crypto.BufferedBlockCipher;
+
+/**
@ -323,7 +324,11 @@ index 0000000..27fd665
+ * them. This method should only be called from the main server thread.
+ */
+ public void b() {
+ for (int i = 1000; channel != null && syncPackets != null && !syncPackets.isEmpty() && i >= 0; i--) {
+ for (int i = 1000; !syncPackets.isEmpty() && i >= 0; i--) {
+ if (handler instanceof PendingConnection ? ((PendingConnection) handler).c : ((PlayerConnection) handler).disconnected) {
+ continue;
+ }
+
+ syncPackets.poll().handle(handler);
+ }
+ }