20973ffd0f
Boat drops and rail placement at this time
59 lines
2.7 KiB
Diff
59 lines
2.7 KiB
Diff
From 76e7fcd0a61b789ca55fb33bb95be63375ed7f23 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 19 Oct 2014 16:01:51 -0500
|
|
Subject: [PATCH] Improve Network Manager packet handling
|
|
|
|
Removes an unnecessary "peek at head of queue", and also makes the number of packets
|
|
processed per player per tick configurable, so larger servers can slow down incoming processing.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index 76a5403..5a5604c 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -154,11 +154,12 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
|
|
private void i() {
|
|
if (this.m != null && this.m.isOpen()) {
|
|
- while (!this.l.isEmpty()) {
|
|
- QueuedPacket queuedpacket = (QueuedPacket) this.l.poll();
|
|
-
|
|
+ // PaperSpigot start - Improve Network Manager packet handling
|
|
+ QueuedPacket queuedpacket;
|
|
+ while ((queuedpacket = (QueuedPacket) this.l.poll()) != null) {
|
|
this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
|
|
}
|
|
+ // PaperSpigot end
|
|
}
|
|
}
|
|
|
|
@@ -175,8 +176,10 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
}
|
|
|
|
if (this.o != null) {
|
|
- for (int i = 1000; !this.k.isEmpty() && i >= 0; --i) {
|
|
- Packet packet = (Packet) this.k.poll();
|
|
+ // PaperSpigot start - Improve Network Manager packet handling - Configurable packets per player per tick processing
|
|
+ Packet packet;
|
|
+ for (int i = org.github.paperspigot.PaperSpigotConfig.maxPacketsPerPlayer; (packet = (Packet) this.k.poll()) != null && i >= 0; --i) {
|
|
+ // PaperSpigot end
|
|
|
|
// CraftBukkit start
|
|
if (!this.isConnected() || !this.m.config().isAutoRead()) {
|
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
|
index a7b18e4..df42019 100644
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
|
@@ -169,4 +169,10 @@ public class PaperSpigotConfig
|
|
strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D );
|
|
weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
|
|
}
|
|
+
|
|
+ public static int maxPacketsPerPlayer;
|
|
+ private static void maxPacketsPerPlayer()
|
|
+ {
|
|
+ maxPacketsPerPlayer = getInt( "max-packets-per-player", 1000 );
|
|
+ }
|
|
}
|
|
--
|
|
1.9.1
|
|
|