Improve keepalive ping system
Send more keepalives, record all transactions within the last minute. We send more keepalives so that the latency calculation is more accurate. Since we send more keepalives, we track all pending keepalives in case multiple end up in flight. Additionally, replace the latency calculation with a true average over the last 5 seconds of keepalive transactions.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -29,30 +_,67 @@
|
||||
@@ -29,14 +_,14 @@
|
||||
import net.minecraft.util.profiling.Profiler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@ -15,11 +15,9 @@
|
||||
- protected final Connection connection;
|
||||
+ public final Connection connection; // Paper
|
||||
private final boolean transferred;
|
||||
- private long keepAliveTime;
|
||||
+ private long keepAliveTime = Util.getMillis(); // Paper
|
||||
private long keepAliveTime;
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
private long closedListenerTime;
|
||||
@@ -45,14 +_,51 @@
|
||||
private boolean closed = false;
|
||||
private int latency;
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
|
||||
Reference in New Issue
Block a user