mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-19 06:02:02 +01:00
e1553a3f25
Since Waterfall is now using Log4J for logging, these patches no longer have any effect.
48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From dbd8dc11b91da5743cca7945485b3e76cacdeb55 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 1dd0aeba..bc56d4f3 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.14.1
|
|
|