Re-add dropped keep alive disconnect

Should fix the terminal spam
This commit is contained in:
Zach Brown 2019-05-13 23:17:05 -05:00
parent d84080e6d1
commit 6c2a2f2dd2
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
14 changed files with 56 additions and 55 deletions

View File

@ -1,4 +1,4 @@
From 732dd110cfd78c4edb4c357ec5c29d15bc5f23be Mon Sep 17 00:00:00 2001
From 4e485cbab344eb8fc53ff37f217af37f7fcb7fee Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 15 Oct 2017 00:29:07 +0100
Subject: [PATCH] revert serverside behavior of keepalives
@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index de34c4e3ee..bb276daa72 100644
index 61793dd1d..43d760bed 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -70,7 +70,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -37,11 +37,14 @@ index de34c4e3ee..bb276daa72 100644
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@@ -179,18 +180,25 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -179,18 +180,26 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
this.minecraftServer.getMethodProfiler().enter("keepAlive");
- long i = SystemUtils.getMonotonicMillis();
-
- if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit
- if (this.awaitingKeepAlive) {
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = SystemUtils.getMonotonicMillis();
@ -50,6 +53,12 @@ index de34c4e3ee..bb276daa72 100644
+ if (this.isPendingPing()) {
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
- } else {
- this.awaitingKeepAlive = true;
- this.lastKeepAlive = i;
- this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+ }
+ } else {
+ if (elapsedTime >= 15000L) { // 15 seconds
@ -57,15 +66,7 @@ index de34c4e3ee..bb276daa72 100644
+ this.setLastPing(currentTime);
+ this.setKeepAliveID(currentTime);
+ this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID()));
- if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit
- if (this.awaitingKeepAlive) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
- } else {
- this.awaitingKeepAlive = true;
- this.lastKeepAlive = i;
- this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+
}
}
+ // Paper end

View File

@ -1,4 +1,4 @@
From b215862783231105934553ef2bcbff6842ffc270 Mon Sep 17 00:00:00 2001
From 656a998539570c42454901792d293db9d564a39f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent
@ -14,10 +14,10 @@ completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 766918e8c..c6a44c5f2 100644
index 43d760bed..49dd552e1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -519,10 +519,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -520,10 +520,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
@ -30,7 +30,7 @@ index 766918e8c..c6a44c5f2 100644
return;
}
// CraftBukkit end
@@ -532,12 +532,35 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -533,12 +533,35 @@ public class PlayerConnection implements PacketListenerPlayIn {
stringreader.skip();
}

View File

@ -1,14 +1,14 @@
From 51dc2519e60f89dd9c4de4c6af0ea827965234f4 Mon Sep 17 00:00:00 2001
From 8ae85ac32ee954771ed025321ec96f1bd6a8a870 Mon Sep 17 00:00:00 2001
From: 0x22 <0x22@futureclient.net>
Date: Thu, 26 Apr 2018 04:41:11 -0400
Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c6a44c5f2..83fc7b285 100644
index 49dd552e1..8be09b1d0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2515,7 +2515,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2516,7 +2516,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {

View File

@ -1,4 +1,4 @@
From 406946910753952b8098c82d040f81a2ee43b140 Mon Sep 17 00:00:00 2001
From ae262d3e841a81051fe5bd507310cd19198e5c9b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -88,10 +88,10 @@ index 29ebee2d9..d46ddba34 100644
this.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 83fc7b285..f436e0259 100644
index 8be09b1d0..0385eced6 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2049,7 +2049,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2050,7 +2050,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
if (this.player.isFrozen()) return; // CraftBukkit

View File

@ -1,4 +1,4 @@
From 5d503244679ce20247006373ec4de24358e9fab4 Mon Sep 17 00:00:00 2001
From 18e9e428c7d662cd27c7c7591dc214e6a7e062fb Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 13 Jul 2018 14:54:43 +0200
Subject: [PATCH] Refresh player inventory when cancelling
@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f436e0259..6d61a1e79 100644
index 0385eced6..4c99a321b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1963,6 +1963,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1964,6 +1964,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
if (event.isCancelled()) {

View File

@ -1,4 +1,4 @@
From c1c208a820e58af16864c27bf94f9a28549bfbb7 Mon Sep 17 00:00:00 2001
From a52d0d7dbfa1059beaf5343bf01a9a00ef1c25d6 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 29 Jul 2018 05:02:15 +0100
Subject: [PATCH] Break up and make tab spam limits configurable
@ -45,7 +45,7 @@ index 8c3880c83..d773ef5b0 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 6d61a1e79..d163836d0 100644
index 4c99a321b..07e9abda9 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -76,6 +76,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -56,7 +56,7 @@ index 6d61a1e79..d163836d0 100644
// CraftBukkit end
private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap();
@@ -203,6 +204,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -204,6 +205,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.minecraftServer.getMethodProfiler().exit();
// CraftBukkit start
for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
@ -64,7 +64,7 @@ index 6d61a1e79..d163836d0 100644
/* Use thread-safe field access instead
if (this.chatThrottle > 0) {
--this.chatThrottle;
@@ -521,7 +523,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -522,7 +524,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start

View File

@ -1,4 +1,4 @@
From a96103ced927454e05bb337ceca2bbf72ba0a4e9 Mon Sep 17 00:00:00 2001
From a46f8e0c304dc2f0dee724d7ac35f09b965ffbe0 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Mon, 22 Oct 2018 17:34:10 +0200
Subject: [PATCH] Add option to prevent players from moving into unloaded
@ -20,10 +20,10 @@ index fb44fccc9..ad793ffa3 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d163836d0..3eae38a8a 100644
index 07e9abda9..4ba13da1a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -346,6 +346,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -347,6 +347,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -37,7 +37,7 @@ index d163836d0..3eae38a8a 100644
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
@@ -888,9 +895,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -889,9 +896,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
double d1 = this.player.locY;
double d2 = this.player.locZ;
double d3 = this.player.locY;
@ -49,7 +49,7 @@ index d163836d0..3eae38a8a 100644
float f = packetplayinflying.a(this.player.yaw);
float f1 = packetplayinflying.b(this.player.pitch);
double d7 = d4 - this.l;
@@ -930,6 +937,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -931,6 +938,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
speed = player.abilities.walkSpeed * 10f;
}

View File

@ -1,14 +1,14 @@
From 8dbf7d82a6cf1bdadb7c5a18c5f7d4152791a857 Mon Sep 17 00:00:00 2001
From 8258ab7472f39b956fb975a6a6f756616bb74f1d Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Nov 2018 21:01:09 +0000
Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3eae38a8a..bd7c13e7f 100644
index 4ba13da1a..a887be15c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1245,6 +1245,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1246,6 +1246,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:

View File

@ -1,4 +1,4 @@
From 293d53fc28714f65f571ed4aafcace9cc70bf975 Mon Sep 17 00:00:00 2001
From c335294d30c27c8a13d79692ee1ad4dc2345967c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 16 Nov 2018 23:08:50 -0500
Subject: [PATCH] Book Size Limits
@ -22,7 +22,7 @@ index a79cba50e..e5e41c662 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index bd7c13e7f..f46a4868b 100644
index a887be15c..baab1a88a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -14,6 +14,7 @@ import java.util.Iterator;
@ -33,7 +33,7 @@ index bd7c13e7f..f46a4868b 100644
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -783,6 +784,42 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -784,6 +785,42 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {

View File

@ -1,4 +1,4 @@
From 414ae3622b3470e439711445447b5bef8dfb0053 Mon Sep 17 00:00:00 2001
From 491f3663daa40e7a223147f6d323a44a46047cda Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com>
Date: Sun, 16 Dec 2018 13:07:33 +1100
Subject: [PATCH] Fix PlayerEditBookEvent
@ -10,10 +10,10 @@ it impossible to properly cancel the event or modify the book meta
cancelled writing
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f46a4868b..448645e52 100644
index baab1a88a..f007290ff 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -859,9 +859,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -860,9 +860,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
itemstack2.a("pages", (NBTBase) nbttaglist);
this.player.a(packetplayinbedit.d(), CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit
} else {

View File

@ -1,4 +1,4 @@
From 10f84a9bf3351fb48bf6ab781861e150b7b4398e Mon Sep 17 00:00:00 2001
From 0b005e5589525440cfe05fa94ebc7136896400ab Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Feb 2019 00:15:28 -0500
Subject: [PATCH] Fix sign edit memory leak
@ -6,10 +6,10 @@ Subject: [PATCH] Fix sign edit memory leak
when a player edits a sign, a reference to their Entity is never cleand up.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 448645e52..1ff7825be 100644
index f007290ff..7c9cd1aa4 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2560,7 +2560,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2561,7 +2561,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;

View File

@ -1,4 +1,4 @@
From 4ce31deee65fb7ff9e1d6cb451cca751cdc444ff Mon Sep 17 00:00:00 2001
From 9743720c4d499892237680e2472ac9e2fae6b334 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Feb 2019 22:18:40 -0500
Subject: [PATCH] Limit Client Sign length more
@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 1ff7825be..8f9a02629 100644
index 7c9cd1aa4..09030abc7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -103,6 +103,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -33,7 +33,7 @@ index 1ff7825be..8f9a02629 100644
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
@@ -2576,6 +2577,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2577,6 +2578,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {

View File

@ -1,4 +1,4 @@
From 3fba1c0e308d323e7657e28ee82febef76a60f8f Mon Sep 17 00:00:00 2001
From 4fc311bca01094a96da585c3517be8a95a60e037 Mon Sep 17 00:00:00 2001
From: AgentTroll <woodyc40@gmail.com>
Date: Fri, 22 Mar 2019 22:24:03 -0700
Subject: [PATCH] Update entity Metadata for all tracked players
@ -22,10 +22,10 @@ index afd8748da..17b6ab57c 100644
this.f.accept(packet);
if (this.tracker instanceof EntityPlayer) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8f9a02629..ef57cd68f 100644
index 09030abc7..5b4576388 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2020,7 +2020,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2021,7 +2021,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
// Refresh the current entity metadata

View File

@ -1,14 +1,14 @@
From 1c49d5e92992eed534dcf79ce695c622da25f932 Mon Sep 17 00:00:00 2001
From 29410d90a8787024ecddceec646e7d5c650aa3f9 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 10 May 2019 18:38:19 +0100
Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ef57cd68f..2b48ebbc3 100644
index 5b4576388..e517e9f9f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -281,7 +281,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -282,7 +282,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.networkManager.getClass();
// CraftBukkit - Don't wait