13
0
geforkt von Mirrors/Velocity

Close one last "proxy crasher" loophole

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-04-12 17:05:36 -04:00
Ursprung b04b43954f
Commit f49d36b719

Datei anzeigen

@ -152,7 +152,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
}
}
ctx.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER);
installDiscardHandler(ctx);
ctx.close();
}
}
@ -168,6 +168,14 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
Preconditions.checkState(this.channel.eventLoop().inEventLoop(), "Not in event loop");
}
private void installDiscardHandler(ChannelHandlerContext ctx) {
ctx.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER);
}
private void installDiscardHandler() {
channel.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER);
}
public EventLoop eventLoop() {
return channel.eventLoop();
}
@ -208,6 +216,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
public void closeWith(Object msg) {
if (channel.isActive()) {
knownDisconnect = true;
installDiscardHandler();
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
}
}
@ -217,6 +226,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
*/
public void close() {
if (channel.isActive()) {
installDiscardHandler();
channel.close();
}
}