aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-10-27 09:43:00 +0100
committerNassim Jahnke <[email protected]>2024-10-27 10:03:59 +0100
commit348c8550967380d9843e365e769f67eee8a8e474 (patch)
tree185991293a5343239e1107ebc98df37de3d020a5 /patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch
parentbcf52fe5fd7b178e3c72f53762c8e32ca7910dc4 (diff)
downloadPaper-348c8550967380d9843e365e769f67eee8a8e474.tar.gz
Paper-348c8550967380d9843e365e769f67eee8a8e474.zip
Readd last API patch (with TODO)
Diffstat (limited to 'patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch')
-rw-r--r--patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch b/patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch
new file mode 100644
index 0000000000..63f9be4942
--- /dev/null
+++ b/patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Gegy <[email protected]>
+Date: Mon, 26 Aug 2024 19:45:07 +0200
+Subject: [PATCH] Fix: synchronise sending chat to client with updating message
+ signature cache
+
+In the case where multiple messages from different players are being processed in parallel, there was a potential race condition where the messages would be sent to the client in a different order than the message signature cache was updated. However, the cache relies on the fact that the client and server get the exact same updates in the same order. This race condition would cause the caches to become corrupted, and any future message received by the client would fail to validate.
+
+This also applies to the last seen state of the server, which becomes inconsistent in the same way as the message signature cache and would cause any messages sent to be rejected by the server too.
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index 654531ada32d3adacca71546480abeebfdad40d3..b57f9e048581f67ab031731553e82829d7eb7c1d 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -2663,8 +2663,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+ return;
+ }
+ // CraftBukkit end
++ // Paper start - Ensure that client receives chat packets in the same order that we add into the message signature cache
++ synchronized (this.messageSignatureCache) {
+ this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params));
+ this.addPendingMessage(message);
++ }
++ // Paper end - Ensure that client receives chat packets in the same order that we add into the message signature cache
+ }
+
+ public void sendDisguisedChatMessage(Component message, ChatType.Bound params) {