Esempio n. 1
0
            /// <exception cref="System.Exception"/>
            public override void MessageReceived(ChannelHandlerContext ctx, MessageEvent e)
            {
                RpcResponse r = (RpcResponse)e.GetMessage();

                byte[]        fragmentHeader = XDR.RecordMark(r.Data().ReadableBytes(), true);
                ChannelBuffer header         = ChannelBuffers.WrappedBuffer(fragmentHeader);
                ChannelBuffer d = ChannelBuffers.WrappedBuffer(header, r.Data());

                e.GetChannel().Write(d);
            }
Esempio n. 2
0
        /// <summary>Write an XDR message to a TCP ChannelBuffer</summary>
        public static ChannelBuffer WriteMessageTcp(XDR request, bool last)
        {
            Preconditions.CheckState(request.state == XDR.State.Writing);
            ByteBuffer b = request.buf.Duplicate();

            b.Flip();
            byte[]     fragmentHeader = XDR.RecordMark(b.Limit(), last);
            ByteBuffer headerBuf      = ByteBuffer.Wrap(fragmentHeader);

            // TODO: Investigate whether making a copy of the buffer is necessary.
            return(ChannelBuffers.CopiedBuffer(headerBuf, b));
        }