Search in sources :

Example 1 with Header

use of io.dingodb.net.netty.packet.Header in project dingo by dingodb.

the class MessageDecoder method decode.

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
    if (!ctx.channel().isOpen()) {
        if (in.readableBytes() > 0) {
            log.info("Channel is closed, discarding remaining {} byte(s) in buffer.", in.readableBytes());
        }
        in.skipBytes(in.readableBytes());
        return;
    }
    ByteBuf messageBuf = readMessageBuf(in);
    if (messageBuf == null) {
        return;
    }
    Header header = readHeader(messageBuf);
    Message message = readMessage(messageBuf);
    out.add(new MessagePacket(header, message));
    messageBuf.release();
}
Also used : MessagePacket(io.dingodb.net.netty.packet.impl.MessagePacket) Header(io.dingodb.net.netty.packet.Header) Message(io.dingodb.net.Message) SimpleMessage(io.dingodb.net.SimpleMessage) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

Message (io.dingodb.net.Message)1 SimpleMessage (io.dingodb.net.SimpleMessage)1 Header (io.dingodb.net.netty.packet.Header)1 MessagePacket (io.dingodb.net.netty.packet.impl.MessagePacket)1 ByteBuf (io.netty.buffer.ByteBuf)1