Bit nicer for TagAPI

This commit is contained in:
md_5 2013-02-18 17:46:31 +11:00
parent 6546568a17
commit d948300c35

View file

@ -1,4 +1,4 @@
From a83d974ced13c39e515fdfc3fa729e2dc68c7cfc Mon Sep 17 00:00:00 2001
From 9a36abf31107d61dfaef4185db9753b098245ae8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 14 Feb 2013 17:32:20 +1100
Subject: [PATCH] Netty
@ -18,14 +18,14 @@ This commit is licensed under the Creative Commons Attribution-ShareAlike 3.0 Un
.../net/minecraft/server/Packet56MapChunkBulk.java | 2 +-
.../net/minecraft/server/PendingConnection.java | 13 +-
src/main/java/org/spigotmc/netty/CipherCodec.java | 65 ++++++
.../org/spigotmc/netty/NettyNetworkManager.java | 209 +++++++++++++++++
.../org/spigotmc/netty/NettyNetworkManager.java | 228 +++++++++++++++++++
.../org/spigotmc/netty/NettyServerConnection.java | 105 +++++++++
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
.../java/org/spigotmc/netty/PacketDecoder.java | 63 ++++++
.../java/org/spigotmc/netty/PacketEncoder.java | 43 ++++
.../java/org/spigotmc/netty/PacketListener.java | 100 +++++++++
src/main/java/org/spigotmc/netty/ReadState.java | 16 ++
13 files changed, 866 insertions(+), 7 deletions(-)
13 files changed, 885 insertions(+), 7 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
@ -203,10 +203,10 @@ index 0000000..f25af14
+}
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..5ae8a79
index 0000000..5730244
--- /dev/null
+++ b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
@@ -0,0 +1,209 @@
@@ -0,0 +1,228 @@
+package org.spigotmc.netty;
+
+import io.netty.channel.Channel;
@ -216,6 +216,8 @@ index 0000000..5ae8a79
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.security.PrivateKey;
+import java.util.AbstractList;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutorService;
@ -243,6 +245,22 @@ index 0000000..5ae8a79
+ private static final NettyServerConnection serverConnection = (NettyServerConnection) server.ae();
+ /*========================================================================*/
+ private final Queue<Packet> syncPackets = new ConcurrentLinkedQueue<Packet>();
+ private final List<Packet> highPriorityQueue = new AbstractList<Packet>() {
+ @Override
+ public void add(int index, Packet element) {
+ // NOP
+ }
+
+ @Override
+ public Packet get(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int size() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ private volatile boolean connected;
+ private Channel channel;
+ private SocketAddress address;
@ -327,6 +345,7 @@ index 0000000..5ae8a79
+ packet = PacketListener.callQueued(this, handler, packet);
+ // If handler indicates packet send
+ if (packet != null) {
+ highPriorityQueue.add(packet);
+ channel.write(packet);
+
+ // If needed, check and prepare encryption phase