Archiviert
13
0

Fix the packet sending procedure.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-21 02:18:56 +01:00
Ursprung 858f9ee02d
Commit 524ef2e6c9

Datei anzeigen

@ -174,10 +174,17 @@ abstract class PacketSendingQueue {
// Recompute
marker = current.getAsyncMarker();
hasExpired = marker.hasExpired();
// Could happen due to the timeout listeners
if (!marker.isProcessed()) {
return false;
}
}
// Abort if we're not on the main thread
if (notThreadSafe && !hasExpired) {
// Is it okay to send the packet?
if (!current.isCancelled() && !hasExpired) {
// Make sure we're on the main thread
if (notThreadSafe) {
try {
boolean wantAsync = marker.isMinecraftAsync(current);
boolean wantSync = !wantAsync;
@ -187,7 +194,7 @@ abstract class PacketSendingQueue {
return false;
}
// Let's give it what it wants, then
// Let's give it what it wants
if (onMainThread && wantAsync) {
asynchronousSender.execute(new Runnable() {
@Override
@ -197,31 +204,31 @@ abstract class PacketSendingQueue {
}
});
// The executor will take it from here
// Scheduler will do the rest
return true;
}
} catch (FieldAccessException e) {
e.printStackTrace();
// Skip this packet
// Just drop the packet
return true;
}
}
if (marker.isProcessed() && !current.isCancelled() && !hasExpired) {
// Silently skip players that have logged out
if (isOnline(current.getPlayer())) {
sendPacket(current);
}
}
// Drop the packet
return true;
}
} else {
// Add it back and stop sending
return false;
}
}
/**
* Invoked when a packet has timed out.