Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +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
|
@Override
|
||||||
protected void initChannel(Channel socketChannel) throws Exception {
|
protected void initChannel(Channel socketChannel) throws Exception {
|
||||||
|
if (!socketChannel.isActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UserConnection info = new UserConnection(socketChannel);
|
UserConnection info = new UserConnection(socketChannel);
|
||||||
// init protocol
|
// init protocol
|
||||||
new ProtocolPipeline(info);
|
new ProtocolPipeline(info);
|
||||||
|
@ -37,6 +37,10 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void decode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
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.checkIncomingPacket()) throw CancelDecoderException.generate(null);
|
||||||
if (!info.shouldTransformPacket()) {
|
if (!info.shouldTransformPacket()) {
|
||||||
out.add(bytebuf.retain());
|
out.add(bytebuf.retain());
|
||||||
|
@ -39,6 +39,10 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
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.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
|
||||||
if (!info.shouldTransformPacket()) {
|
if (!info.shouldTransformPacket()) {
|
||||||
out.add(bytebuf.retain());
|
out.add(bytebuf.retain());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren