3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Simplify MinecraftConnection release logic.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-01-27 22:57:40 -05:00
Ursprung 6d080db48e
Commit 6eb6c99fa7

Datei anzeigen

@ -102,32 +102,25 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
return; return;
} }
if (msg instanceof MinecraftPacket) { try {
if (sessionHandler.beforeHandle()) { if (sessionHandler.beforeHandle()) {
return; return;
} }
MinecraftPacket pkt = (MinecraftPacket) msg; if (msg instanceof MinecraftPacket) {
if (!pkt.handle(sessionHandler)) { MinecraftPacket pkt = (MinecraftPacket) msg;
sessionHandler.handleGeneric((MinecraftPacket) msg); if (!pkt.handle(sessionHandler)) {
} sessionHandler.handleGeneric((MinecraftPacket) msg);
} else if (msg instanceof HAProxyMessage) {
if (sessionHandler.beforeHandle()) {
return;
}
HAProxyMessage proxyMessage = (HAProxyMessage) msg;
this.remoteAddress = new InetSocketAddress(proxyMessage.sourceAddress(),
proxyMessage.sourcePort());
} else if (msg instanceof ByteBuf) {
try {
if (sessionHandler.beforeHandle()) {
return;
} }
} else if (msg instanceof HAProxyMessage) {
HAProxyMessage proxyMessage = (HAProxyMessage) msg;
this.remoteAddress = new InetSocketAddress(proxyMessage.sourceAddress(),
proxyMessage.sourcePort());
} else if (msg instanceof ByteBuf) {
sessionHandler.handleUnknown((ByteBuf) msg); sessionHandler.handleUnknown((ByteBuf) msg);
} finally {
ReferenceCountUtil.release(msg);
} }
} finally {
ReferenceCountUtil.release(msg);
} }
} }