コード例 #1
0
 public override void WriteMessageBegin(TMessage message)
 {
     if (strictWrite_)
     {
         uint version = VERSION_1 | (uint)(message.Type);
         WriteI32((int)version);
         WriteString(message.Name);
         WriteI64(message.SeqID);
     }
     else
     {
         WriteString(message.Name);
         WriteByte((sbyte)message.Type);
         WriteI64(message.SeqID);
     }
 }
コード例 #2
0
        /**
         * Prepends the service name to the function name, separated by TMultiplexedProtocol.SEPARATOR.
         * Args:
         *   tMessage     The original message.
         */
        public override void WriteMessageBegin(TMessage tMessage)
        {
            switch (tMessage.Type)
            {
            case TMessageType.Call:
            case TMessageType.Oneway:
                base.WriteMessageBegin(new TMessage(
                                           ServiceName + SEPARATOR + tMessage.Name,
                                           tMessage.Type,
                                           tMessage.SeqID));
                break;

            default:
                base.WriteMessageBegin(tMessage);
                break;
            }
        }
コード例 #3
0
        public override TMessage ReadMessageBegin()
        {
            TMessage message = new TMessage();

            ReadJSONArrayStart();
            if (ReadJSONInteger() != VERSION)
            {
                throw new TProtocolException(TProtocolException.BAD_VERSION,
                                             "Message contained bad version.");
            }

            var buf = ReadJSONString(false);

            message.Name  = utf8Encoding.GetString(buf, 0, buf.Length);
            message.Type  = (TMessageType)ReadJSONInteger();
            message.SeqID = ReadJSONInteger();
            return(message);
        }
コード例 #4
0
 public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin)
     : base(protocol)
 {
     this.MsgBegin = messageBegin;
 }
コード例 #5
0
ファイル: TProtocol.cs プロジェクト: zzh442856860/Pebble
 public abstract void WriteMessageBegin(TMessage message);
コード例 #6
0
 public override void WriteMessageBegin(TMessage tMessage)
 {
     WrappedProtocol.WriteMessageBegin(tMessage);
 }