f37381ea8a
Removes synchronization from sending packets Makes normal packet sends no longer need to be wrapped and queued like it use to work. Adds more packet queue immunities on top of keep alive to let the following scenarios go out without delay: - Keep Alive - Chat - Kick - All of the packets during the Player Joined World event Hoping that latter one helps join timeout issues more too for slow connections. Removes processing packet queue off of main thread - for the few cases where it is allowed, order is not necessary nor should it even be happening concurrently in first place (handshaking/login/status) Ensures packets sent asynchronously are dispatched on main thread This helps ensure safety for ProtocolLib as packet listeners are commonly accessing world state. This will allow you to schedule a packet to be sent async, but itll be dispatched sync for packet listeners to process. This should solve some deadlock risks This may provide a decent performance improvement because thread synchronization incurs a cache reset so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really hot activity.
38 Zeilen
1.5 KiB
Diff
38 Zeilen
1.5 KiB
Diff
From 3e7391730310c563d073be105c8370cd1be5ac12 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 3 May 2020 14:25:55 -0400
|
|
Subject: [PATCH] Sync position on teleportation
|
|
|
|
We've seen many a cases where the "last good" x/y/z is desynced from
|
|
the x/y/z that is checked for moving too fast.
|
|
|
|
Theory is that when you have multiple movement packets queued up,
|
|
and the player is teleported after the first then the 2nd and 3rd come in,
|
|
it is triggering a massive movement velocity.
|
|
|
|
This will ensure that the servers position is synchronized anytime player is teleported.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 02bda8bee46..a188d9f3b60 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -500,6 +500,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
this.o = this.teleportPos.x;
|
|
this.p = this.teleportPos.y;
|
|
this.q = this.teleportPos.z;
|
|
+ this.syncPosition(); // Paper
|
|
if (this.player.H()) {
|
|
this.player.I();
|
|
}
|
|
@@ -1271,6 +1272,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
|
|
this.A = this.e;
|
|
this.player.setLocation(d0, d1, d2, f, f1);
|
|
+ this.syncPosition(); // Paper
|
|
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
|
|
}
|
|
|
|
--
|
|
2.26.2
|
|
|