summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorRigby <rigby@onarandombox.com>2011-07-26 17:03:52 +0100
committerEvilSeph <evilseph@gmail.com>2011-08-03 20:55:44 -0400
commit6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f (patch)
tree741ba86a905d2e64e5e197c26b39e41a56f8560d /src/main/java/net
parent85805e53a329d0526eb9736068b83950bd98ab68 (diff)
downloadcraftbukkit-6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f.tar
craftbukkit-6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f.tar.gz
craftbukkit-6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f.tar.lz
craftbukkit-6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f.tar.xz
craftbukkit-6ae23e3f033e8dcbf49d4d7067062d322a9a3c7f.zip
Chunk Compression on seperate thread. Thanks to Zeerix.
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java3
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java5
-rw-r--r--src/main/java/net/minecraft/server/Packet51MapChunk.java7
3 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 04628ddb..6481e0d0 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -7,6 +7,7 @@ import java.util.Set;
// CraftBukkit start
import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.ChunkCompressionThread;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.entity.EntityDeathEvent;
@@ -209,7 +210,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (chunkcoordintpair != null) {
boolean flag1 = false;
- if (this.netServerHandler.b() < 4) {
+ if (this.netServerHandler.b() + ChunkCompressionThread.getPlayerQueueSize(this) < 4) { // CraftBukkit - Add check against Chunk Packets in the ChunkCompressionThread.
flag1 = true;
}
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 4744063d..43b45647 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -7,6 +7,7 @@ import java.util.logging.Logger;
// CraftBukkit start
import org.bukkit.ChatColor;
+import org.bukkit.craftbukkit.ChunkCompressionThread;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.Location;
import org.bukkit.command.CommandException;
@@ -629,6 +630,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.networkManager.queue(new Packet3Chat(line));
}
packet = null;
+ } else if (packet.k == true) {
+ // Reroute all low-priority packets through to compression thread.
+ ChunkCompressionThread.sendPacket(this.player, packet);
+ packet = null;
}
if (packet != null) this.networkManager.queue(packet);
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
index c2ca83bd..3bf163f6 100644
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
@@ -16,7 +16,8 @@ public class Packet51MapChunk extends Packet {
public int e;
public int f;
public byte[] g;
- private int h;
+ public int h; // CraftBukkit - private -> public
+ public byte[] rawData; // CraftBukkit
public Packet51MapChunk() {
this.k = true;
@@ -36,6 +37,7 @@ public class Packet51MapChunk extends Packet {
this.d = l;
this.e = i1;
this.f = j1;
+ /* CraftBukkit - Moved compression into its own method.
byte[] abyte = data; // CraftBukkit - uses data from above constructor
Deflater deflater = new Deflater(-1);
@@ -46,7 +48,8 @@ public class Packet51MapChunk extends Packet {
this.h = deflater.deflate(this.g);
} finally {
deflater.end();
- }
+ }*/
+ this.rawData = data; // CraftBukkit
}
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOEXception