geforkt von Mirrors/Paper
26734e83b0
* Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 8085edde SPIGOT-6918: Add SpawnCategory API and configurations for Axolotls 04c7e13c PR-719: Add Player Profile API 71564210 SPIGOT-6910: Add BlockDamageAbortEvent CraftBukkit Changes: febaa1c6 SPIGOT-6918: Add SpawnCategory API and configurations for Axolotls 9dafd109 Don't send updates over large distances bdac46b0 SPIGOT-6782: EntityPortalEvent should not destroy entity when setTo() uses same world as getFrom() 8f361ece PR-1002: Add Player Profile API 911875d4 Increase outdated build delay e5f8a767 SPIGOT-6917: Use main scoreboard for /trigger a672a531 Clean up callBlockDamageEvent 8e1bdeef SPIGOT-6910: Add BlockDamageAbortEvent Spigot Changes: 6edb62f3 Rebuild patches 7fbc6a1e Rebuild patches * Updated Upstream (CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: de951355 SPIGOT-6927: Fix default value of spawn-limits in Worlds
78 Zeilen
4.7 KiB
Diff
78 Zeilen
4.7 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
This patch intends to bump up the time that a client has to reply to the
|
|
server back to 30 seconds as per pre 1.12.2, which allowed clients
|
|
more than enough time to reply potentially allowing them to be less
|
|
tempermental due to lag spikes on the network thread, e.g. that caused
|
|
by plugins that are interacting with netty.
|
|
|
|
We also add a system property to allow people to tweak how long the server
|
|
will wait for a reply. There is a compromise here between lower and higher
|
|
values, lower values will mean that dead connections can be closed sooner,
|
|
whereas higher values will make this less sensitive to issues such as spikes
|
|
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/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 849b94665e20aca54bd1df0cd8f4e3d5be30e31c..5b8ecb96f0a6dbc9e396644b074b50ccb7b38e78 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -220,9 +220,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
private final MinecraftServer server;
|
|
public ServerPlayer player;
|
|
private int tickCount;
|
|
- private long keepAliveTime; @Deprecated private void setLastPing(long lastPing) { this.keepAliveTime = lastPing;}; @Deprecated private long getLastPing() { return this.keepAliveTime;}; // Paper - OBFHELPER
|
|
- private boolean keepAlivePending; @Deprecated private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; @Deprecated private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER
|
|
- private long keepAliveChallenge; @Deprecated private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; @Deprecated private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER
|
|
+ private long keepAliveTime = Util.getMillis();
|
|
+ private boolean keepAlivePending;
|
|
+ private long keepAliveChallenge;
|
|
// CraftBukkit start - multithreaded fields
|
|
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
|
|
// CraftBukkit end
|
|
@@ -251,6 +251,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
private int aboveGroundVehicleTickCount;
|
|
private int receivedMovePacketCount;
|
|
private int knownMovePacketCount;
|
|
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
|
|
|
|
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
|
|
this.server = server;
|
|
@@ -332,18 +333,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
}
|
|
|
|
this.server.getProfiler().push("keepAlive");
|
|
- long i = Util.getMillis();
|
|
-
|
|
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
|
- if (this.keepAlivePending) {
|
|
- this.disconnect(new TranslatableComponent("disconnect.timeout"));
|
|
- } else {
|
|
+ // 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 = Util.getMillis();
|
|
+ long elapsedTime = currentTime - this.keepAliveTime;
|
|
+
|
|
+ if (this.keepAlivePending) {
|
|
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
|
+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
|
|
+ this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]));
|
|
+ }
|
|
+ } else {
|
|
+ if (elapsedTime >= 15000L) { // 15 seconds
|
|
this.keepAlivePending = true;
|
|
- this.keepAliveTime = i;
|
|
- this.keepAliveChallenge = i;
|
|
+ this.keepAliveTime = currentTime;
|
|
+ this.keepAliveChallenge = currentTime;
|
|
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
|
|
}
|
|
}
|
|
+ // Paper end
|
|
|
|
this.server.getProfiler().pop();
|
|
// CraftBukkit start
|