Waterfall/BungeeCord-Patches/0018-Resolve-sendData-deadlocks.patch
Shane Freeder 757945e1eb give the project some TLC
- Respect bungeecords new "log ping" configuration along side our own
  Waterfalls patch will likely be dropped by the end of the year, migrate!
- Drop 'Don't allow channel buffers to grow beyond a reasonable limit'
  This is already included upstream and is configurable using system properties
- Drop 'Security enhancements for EncryptionUtil'
  This patch is somewhat misguided given how mojangs auth service works and offers
  no real improvements to security
- cleanup some patches
  updated headers for changes which have been removed/extracted into other patches
  cleaned up some code formatting changes in misc sections
- touch up the contributing guide to reflect the recent script changes
2018-09-17 03:07:48 +01:00

48 lines
1.6 KiB
Diff

From 896b13140d424a1ec5d7aa882c9f3c479716e3d5 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 89c8f48f..9756c09c 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
@@ -101,19 +101,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;
}
@Override
--
2.19.0