mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-30 07:27:46 +02:00
Fix unnecessary allocation on ping
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
bcab1b199b
commit
2289cf32e1
@ -85,8 +85,6 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
this.workerQueue = worker.queue();
|
this.workerQueue = worker.queue();
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.remoteAddress = remoteAddress;
|
this.remoteAddress = remoteAddress;
|
||||||
POOL.register(this, tickBuffer);
|
|
||||||
POOL.register(this, waitingBuffers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPackets(BinaryBuffer readBuffer, PacketProcessor packetProcessor) {
|
public void processPackets(BinaryBuffer readBuffer, PacketProcessor packetProcessor) {
|
||||||
@ -203,7 +201,16 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
@Override
|
@Override
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
super.disconnect();
|
super.disconnect();
|
||||||
this.workerQueue.relaxedOffer(() -> this.worker.disconnect(this, channel));
|
this.workerQueue.relaxedOffer(() -> {
|
||||||
|
this.worker.disconnect(this, channel);
|
||||||
|
final BinaryBuffer tick = tickBuffer.get();
|
||||||
|
if (tick != null) {
|
||||||
|
POOL.add(tick);
|
||||||
|
this.tickBuffer.set(null);
|
||||||
|
}
|
||||||
|
for (BinaryBuffer buffer : waitingBuffers) POOL.add(buffer);
|
||||||
|
this.waitingBuffers.clear();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull SocketChannel getChannel() {
|
public @NotNull SocketChannel getChannel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user