chore[tunnel]: enhance the robustness of the code

This commit is contained in:
jaysunxiao committed 2025-08-08 17:31:22 +08:00
1 parent d30d46a105
commit da315a1818
1 file changed
+5 -1
@@ -92,7 +92,11 @@ public class TunnelServerCodecHandler extends ByteToMessageCodec<TunnelProtocolS
}
var retainedByteBuf = in.readRetainedSlice(length);
session.getChannel().writeAndFlush(TunnelProtocolServer2Client.valueOf(sid, uid, retainedByteBuf));
try {
session.getChannel().writeAndFlush(TunnelProtocolServer2Client.valueOf(sid, uid, retainedByteBuf));
} catch (Throwable t) {
ReferenceCountUtil.release(retainedByteBuf);
}
}
@Override