Attempt to fix leak

This commit is contained in:
Adrian Bergqvist 2022-11-24 19:58:07 +01:00
parent d26eee4610
commit 97f1d2b493
No known key found for this signature in database
GPG Key ID: FAE7D8EDE225E686
3 changed files with 16 additions and 12 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group 'org.adde0109'
version '1.1.4'
version '1.1.4-alpha'
repositories {
maven {
@ -21,8 +21,8 @@ dependencies {
implementation 'com.electronwill.night-config:toml:3.6.5'
implementation 'org.bstats:bstats-velocity:3.0.0'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'io.netty:netty-buffer:4.1.79.Final'
implementation 'io.netty:netty-transport:4.1.79.Final'
compileOnly 'io.netty:netty-buffer:4.1.85.Final'
compileOnly 'io.netty:netty-transport:4.1.85.Final'
}
shadowJar {

View File

@ -10,7 +10,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
public class FML2CRPMResetCompleteDecoder extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof ByteBuf buf) {
if (!ctx.channel().isActive() || !buf.isReadable()) {
buf.release();
@ -21,13 +21,18 @@ public class FML2CRPMResetCompleteDecoder extends ChannelInboundHandlerAdapter {
int packetId = ProtocolUtils.readVarInt(buf);
if (packetId == 0x02 && buf.readableBytes() > 1) {
try {
MinecraftPacket packet = new LoginPluginResponse();
packet.decode(buf, ProtocolUtils.Direction.SERVERBOUND,null);
ctx.fireChannelRead(packet);
} finally {
buf.release();
}
return;
int id = ProtocolUtils.readVarInt(buf);
boolean success = buf.readBoolean();
if (id == 98) {
try {
MinecraftPacket packet = new LoginPluginResponse(id,success,buf.readRetainedSlice(buf.readableBytes()));
ctx.fireChannelRead(packet);
} finally {
buf.release();
}
return;
}
} catch (Exception ignored) {}
} else {
buf.readerIndex(originalReaderIndex);
}

View File

@ -96,7 +96,6 @@ public class FML2ClientConnectionPhase extends VelocityForgeClientConnectionPhas
public void handleJoinGame() {
this.onJoinGame.complete(null);
this.onJoinGame = null;
}
public CompletableFuture<Void> awaitJoinGame() {