mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-26 02:57:37 +01:00
Fix synchronization issue with viewable packets
This commit is contained in:
parent
0934c8ef16
commit
2e02dfd4d8
@ -284,7 +284,7 @@ public final class PacketUtils {
|
|||||||
PooledBuffers.registerBuffer(this, buffer);
|
PooledBuffers.registerBuffer(this, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void append(Viewable viewable, ServerPacket serverPacket, Player player) {
|
private synchronized void append(Viewable viewable, ServerPacket serverPacket, Player player) {
|
||||||
final ByteBuffer framedPacket = createFramedPacket(serverPacket);
|
final ByteBuffer framedPacket = createFramedPacket(serverPacket);
|
||||||
final int packetSize = framedPacket.limit();
|
final int packetSize = framedPacket.limit();
|
||||||
if (packetSize >= buffer.capacity()) {
|
if (packetSize >= buffer.capacity()) {
|
||||||
@ -307,7 +307,7 @@ public final class PacketUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(Viewable viewable) {
|
private synchronized void process(Viewable viewable) {
|
||||||
if (buffer.writerOffset() == 0) return;
|
if (buffer.writerOffset() == 0) return;
|
||||||
ByteBuffer copy = ByteBuffer.allocateDirect(buffer.writerOffset());
|
ByteBuffer copy = ByteBuffer.allocateDirect(buffer.writerOffset());
|
||||||
copy.put(buffer.asByteBuffer(0, copy.capacity()));
|
copy.put(buffer.asByteBuffer(0, copy.capacity()));
|
||||||
|
Loading…
Reference in New Issue
Block a user