mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-22 12:05:45 +01:00
revert codec changes, it broke
This commit is contained in:
parent
764f849d79
commit
a2e90f79d0
@ -201,17 +201,31 @@ class FrameCodec : ByteToMessageCodec<ByteBuf>() {
|
||||
class CloudViaCodec(val info: UserConnection) : MessageToMessageCodec<ByteBuf, ByteBuf>() {
|
||||
override fun decode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) {
|
||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null)
|
||||
if (info.shouldTransformPacket()) {
|
||||
info.transformIncoming(bytebuf, CancelDecoderException::generate)
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain())
|
||||
return
|
||||
}
|
||||
val transformedBuf: ByteBuf = ctx.alloc().buffer().writeBytes(bytebuf)
|
||||
try {
|
||||
info.transformIncoming(transformedBuf, CancelDecoderException::generate)
|
||||
out.add(transformedBuf.retain())
|
||||
} finally {
|
||||
transformedBuf.release()
|
||||
}
|
||||
out.add(bytebuf.retain())
|
||||
}
|
||||
|
||||
override fun encode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) {
|
||||
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null)
|
||||
if (info.shouldTransformPacket()) {
|
||||
info.transformOutgoing(bytebuf, CancelEncoderException::generate)
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain())
|
||||
return
|
||||
}
|
||||
val transformedBuf: ByteBuf = ctx.alloc().buffer().writeBytes(bytebuf)
|
||||
try {
|
||||
info.transformOutgoing(transformedBuf, CancelEncoderException::generate)
|
||||
out.add(transformedBuf.retain())
|
||||
} finally {
|
||||
transformedBuf.release()
|
||||
}
|
||||
out.add(bytebuf.retain())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user