Chunk Compression on seperate thread. Thanks to Zeerix.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user