2018-09-16 18:06:25 +02:00
|
|
|
From 896b13140d424a1ec5d7aa882c9f3c479716e3d5 Mon Sep 17 00:00:00 2001
|
2016-05-28 18:34:39 +02:00
|
|
|
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
|
2018-04-23 22:04:05 +02:00
|
|
|
index 89c8f48f..9756c09c 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- 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
|
|
|
|
--
|
2018-09-16 18:06:25 +02:00
|
|
|
2.19.0
|
2016-05-28 18:34:39 +02:00
|
|
|
|