#3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method
This commit is contained in:
parent
6263fe283b
commit
6324c7d527
@ -103,26 +103,30 @@ public class BungeeServerInfo implements ServerInfo
|
|||||||
sendData( channel, data, true );
|
sendData( channel, data, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Don't like this method
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendData(String channel, byte[] data, boolean queue)
|
public boolean sendData(String channel, byte[] data, boolean queue)
|
||||||
{
|
{
|
||||||
Preconditions.checkNotNull( channel, "channel" );
|
Preconditions.checkNotNull( channel, "channel" );
|
||||||
Preconditions.checkNotNull( data, "data" );
|
Preconditions.checkNotNull( data, "data" );
|
||||||
|
|
||||||
synchronized ( packetQueue )
|
Server server;
|
||||||
|
synchronized ( players )
|
||||||
{
|
{
|
||||||
Server server = ( players.isEmpty() ) ? null : players.iterator().next().getServer();
|
server = ( players.isEmpty() ) ? null : players.iterator().next().getServer();
|
||||||
|
}
|
||||||
|
|
||||||
if ( server != null )
|
if ( server != null )
|
||||||
{
|
{
|
||||||
server.sendData( channel, data );
|
server.sendData( channel, data );
|
||||||
return true;
|
return true;
|
||||||
} else if ( queue )
|
} else if ( queue )
|
||||||
|
{
|
||||||
|
synchronized ( packetQueue )
|
||||||
{
|
{
|
||||||
packetQueue.add( new PluginMessage( channel, data, false ) );
|
packetQueue.add( new PluginMessage( channel, data, false ) );
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long lastPing;
|
private long lastPing;
|
||||||
|
Loading…
Reference in New Issue
Block a user