Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 00:22:51 +01:00
Cancel Bungee packet encoding when closed (#2448)
Dieser Commit ist enthalten in:
Ursprung
ad0842c107
Commit
f18e2b3875
@ -40,6 +40,10 @@ public class BungeeChannelInitializer extends ChannelInitializer<Channel> {
|
||||
|
||||
@Override
|
||||
protected void initChannel(Channel socketChannel) throws Exception {
|
||||
if (!socketChannel.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserConnection info = new UserConnection(socketChannel);
|
||||
// init protocol
|
||||
new ProtocolPipeline(info);
|
||||
|
@ -37,6 +37,10 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
|
||||
@Override
|
||||
protected void decode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!ctx.channel().isActive()) {
|
||||
throw CancelDecoderException.generate(null);
|
||||
}
|
||||
|
||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
|
@ -39,6 +39,10 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
||||
|
||||
@Override
|
||||
protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!ctx.channel().isActive()) {
|
||||
throw CancelEncoderException.generate(null);
|
||||
}
|
||||
|
||||
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren