Waterfall/BungeeCord-Patches/0018-Resolve-sendData-deadlocks.patch
Shane Freeder c21eed1f7b
Updated Upstream (BungeeCord)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
70370faf Add checkstyle indentation checks
24a53a67 Show socketAddress in BungeeServerInfo.toString
503b4827 Fix bad formatting in EntityMap
eeb37479 #2710: Store queue of pending keepalives
3f6aa033 Also check that things that should not be padded are so
78a84953 Add more checkstyle rules
636c0207 #2753: Add configurable remote ping caching
a4512e50 Check Maven version in action build & don't print noisy transfer progress
f510989c Add building of pull requests via GitHub Actions
2020-01-24 22:41:39 +00:00

48 lines
1.6 KiB
Diff

From bc43bcb3f3d2366bf219df39d735a89622a6b620 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Fri, 12 Feb 2016 23:55:53 -0500
Subject: [PATCH] Resolve sendData() deadlocks
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
index 0874544f..7d7e5a7f 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
@@ -110,19 +110,22 @@ public class BungeeServerInfo implements ServerInfo
Preconditions.checkNotNull( channel, "channel" );
Preconditions.checkNotNull( data, "data" );
- synchronized ( packetQueue )
- {
- Server server = ( players.isEmpty() ) ? null : players.iterator().next().getServer();
- if ( server != null )
- {
- server.sendData( channel, data );
- return true;
- } else if ( queue )
- {
- packetQueue.add( new PluginMessage( channel, data, false ) );
+ Server server;
+
+ synchronized (players) {
+ server = players.isEmpty() ? null : players.iterator().next().getServer();
+ }
+
+ if (server != null) {
+ server.sendData(channel, data);
+ return true;
+ } else if (queue) {
+ synchronized (packetQueue) {
+ packetQueue.add(new PluginMessage(channel, data, false));
}
- return false;
}
+
+ return false;
}
private long lastPing;
--
2.25.0