Example usage for io.netty.channel.sctp SctpMessage content

List of usage examples for io.netty.channel.sctp SctpMessage content

Introduction

In this page you can find the example usage for io.netty.channel.sctp SctpMessage content.

Prototype

@Override
    public ByteBuf content() 

Source Link

Usage

From source file:org.mobicents.protocols.sctp.netty.NettySctpChannelInboundHandlerAdapter.java

License:Open Source License

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
    // try {//  w w  w .j a va  2s  . c  om
    PayloadData payload;
    if (this.association.getIpChannelType() == IpChannelType.SCTP) {
        SctpMessage sctpMessage = (SctpMessage) msg;
        ByteBuf byteBuf = sctpMessage.content();
        payload = new PayloadData(byteBuf.readableBytes(), byteBuf, sctpMessage.isComplete(),
                sctpMessage.isUnordered(), sctpMessage.protocolIdentifier(), sctpMessage.streamIdentifier());
    } else {
        ByteBuf byteBuf = (ByteBuf) msg;
        payload = new PayloadData(byteBuf.readableBytes(), byteBuf, true, false, 0, 0);
    }

    if (logger.isDebugEnabled()) {
        logger.debug(String.format("Rx : Ass=%s %s", this.association.getName(), payload));
    }

    this.association.read(payload);
    // } finally {
    // ReferenceCountUtil.release(msg);
    // }
}