mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 11:38:03 +01:00
cacheBuffer does not need to be volatile
This commit is contained in:
parent
a15156aeb4
commit
62a7346f40
@ -74,7 +74,7 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
|
|
||||||
private final List<BinaryBuffer> waitingBuffers = new ArrayList<>();
|
private final List<BinaryBuffer> waitingBuffers = new ArrayList<>();
|
||||||
private final AtomicReference<BinaryBuffer> tickBuffer = new AtomicReference<>(PooledBuffers.get());
|
private final AtomicReference<BinaryBuffer> tickBuffer = new AtomicReference<>(PooledBuffers.get());
|
||||||
private volatile BinaryBuffer cacheBuffer;
|
private BinaryBuffer cacheBuffer;
|
||||||
|
|
||||||
private final ListenerHandle<PlayerPacketOutEvent> outgoing = EventDispatcher.getHandle(PlayerPacketOutEvent.class);
|
private final ListenerHandle<PlayerPacketOutEvent> outgoing = EventDispatcher.getHandle(PlayerPacketOutEvent.class);
|
||||||
|
|
||||||
@ -124,8 +124,9 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void consumeCache(BinaryBuffer buffer) {
|
public void consumeCache(BinaryBuffer buffer) {
|
||||||
if (cacheBuffer != null) {
|
final BinaryBuffer cache = this.cacheBuffer;
|
||||||
buffer.write(cacheBuffer);
|
if (cache != null) {
|
||||||
|
buffer.write(cache);
|
||||||
this.cacheBuffer = null;
|
this.cacheBuffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user