Make it possible to cancel packets for asynchronous processing.

This commit is contained in:
Kristian S. Stangeland 2013-05-06 18:56:19 +02:00
parent 8d814d2d9c
commit a2b04e055a
2 changed files with 306 additions and 304 deletions

View File

@ -89,6 +89,7 @@ abstract class PacketSendingQueue {
PacketEvent copy = PacketEvent.fromSynchronous(packetUpdated, marker);
// "Cancel" the original event
packetUpdated.setReadOnly(false);
packetUpdated.setCancelled(true);
// Enqueue the copy with the new sending index

View File

@ -496,6 +496,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
asyncFilterManager.enqueueSyncPacket(event, event.getAsyncMarker());
// The above makes a copy of the event, so it's safe to cancel it
event.setReadOnly(false);
event.setCancelled(true);
}
}