Skip to content

Commit

Permalink
#3786: Fix missing compressor release when removing LengthPrependerAn…
Browse files Browse the repository at this point in the history
…dCompressor handler
  • Loading branch information
BoomEaro authored Feb 15, 2025
1 parent 556a15a commit 591e187
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out)
}
}

@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
{
if ( zlib != null )
{
zlib.free();
zlib = null;
}
}

public void setCompose(boolean compose)
{
if ( compose )
Expand Down Expand Up @@ -147,6 +157,7 @@ public void setCompress(boolean compress)
if ( zlib != null )
{
zlib.free();
zlib = null;
}
}
}
Expand Down Expand Up @@ -180,10 +191,6 @@ private static byte varintSize(int value)
{
return 4;
}
if ( MAX_SUPPORTED_VARINT_LENGTH_LEN < 5 )
{
throw new IllegalArgumentException( "Packet length " + value + " longer than supported (max. 268435455 for 4 byte varint)" );
}
return 5;
throw new IllegalArgumentException( "Packet length " + value + " longer than supported (max. 268435455 for 4 byte varint)" );
}
}

0 comments on commit 591e187

Please sign in to comment.