mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-05 10:20:24 +01:00
Renamed 'synchronizeMain' to 'notThreadSafe'.
This commit is contained in:
parent
0b200472f1
commit
858f9ee02d
@ -43,19 +43,19 @@ abstract class PacketSendingQueue {
|
|||||||
// Asynchronous packet sending
|
// Asynchronous packet sending
|
||||||
private Executor asynchronousSender;
|
private Executor asynchronousSender;
|
||||||
|
|
||||||
// Whether or not packet transmission can only occur on the main thread
|
// Whether or not packet transmission must occur on a specific thread
|
||||||
private final boolean synchronizeMain;
|
private final boolean notThreadSafe;
|
||||||
|
|
||||||
// Whether or not we've run the cleanup procedure
|
// Whether or not we've run the cleanup procedure
|
||||||
private boolean cleanedUp = false;
|
private boolean cleanedUp = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a packet sending queue.
|
* Create a packet sending queue.
|
||||||
* @param synchronizeMain - whether or not to synchronize with the main thread.
|
* @param notThreadSafe - whether or not to synchronize with the main thread or a background thread.
|
||||||
*/
|
*/
|
||||||
public PacketSendingQueue(boolean synchronizeMain, Executor asynchronousSender) {
|
public PacketSendingQueue(boolean notThreadSafe, Executor asynchronousSender) {
|
||||||
this.sendingQueue = new PriorityBlockingQueue<PacketEventHolder>(INITIAL_CAPACITY);
|
this.sendingQueue = new PriorityBlockingQueue<PacketEventHolder>(INITIAL_CAPACITY);
|
||||||
this.synchronizeMain = synchronizeMain;
|
this.notThreadSafe = notThreadSafe;
|
||||||
this.asynchronousSender = asynchronousSender;
|
this.asynchronousSender = asynchronousSender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ abstract class PacketSendingQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Abort if we're not on the main thread
|
// Abort if we're not on the main thread
|
||||||
if (synchronizeMain && !hasExpired) {
|
if (notThreadSafe && !hasExpired) {
|
||||||
try {
|
try {
|
||||||
boolean wantAsync = marker.isMinecraftAsync(current);
|
boolean wantAsync = marker.isMinecraftAsync(current);
|
||||||
boolean wantSync = !wantAsync;
|
boolean wantSync = !wantAsync;
|
||||||
@ -253,7 +253,7 @@ abstract class PacketSendingQueue {
|
|||||||
* @return TRUE if it must, FALSE otherwise.
|
* @return TRUE if it must, FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isSynchronizeMain() {
|
public boolean isSynchronizeMain() {
|
||||||
return synchronizeMain;
|
return notThreadSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ class PlayerSendingHandler {
|
|||||||
private PacketSendingQueue clientQueue;
|
private PacketSendingQueue clientQueue;
|
||||||
|
|
||||||
public QueueContainer() {
|
public QueueContainer() {
|
||||||
// Server packets are synchronized already
|
// Server packets can be sent concurrently
|
||||||
serverQueue = new PacketSendingQueue(false, asynchronousSender) {
|
serverQueue = new PacketSendingQueue(false, asynchronousSender) {
|
||||||
@Override
|
@Override
|
||||||
protected void onPacketTimeout(PacketEvent event) {
|
protected void onPacketTimeout(PacketEvent event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user