예제 #1
0
        private int ReadVariableHeader()
        {
            // Variable header could potentially be read by more than one thread but we're OK with that.
            // Just trying to guard against multiple threads reading in the variables at the same time.
            lock (_msg.SyncLock)
            {
                int pos;
                _msg.ReadRemainingLength(out pos);

                _messageId = Frame.DecodeInt16(_msg.MsgBuffer, ref pos);

                _msg.VariableHeaderRead = true;
                return(pos);
            }
        }
예제 #2
0
        private int ReadVariableHeader()
        {
            // Variable header could potentially be read by more than one thread but we're OK with that.
            // Just trying to guard against multiple threads reading in the variables at the same time.
            lock (_msg.SyncLock)
            {
                int pos;
                _msg.ReadRemainingLength(out pos);
                _protocolName    = Frame.DecodeString(_msg.MsgBuffer, ref pos);
                _protocolVersion = _msg.MsgBuffer[pos++];
                _connectFlags    = _msg.MsgBuffer[pos++];
                _keepAliveTime   = Frame.DecodeInt16(_msg.MsgBuffer, ref pos);

                _msg.VariableHeaderRead = true;
                return(pos);
            }
        }
예제 #3
0
        private int ReadVariableHeader()
        {
            // Variable header could potentially be read by more than one thread but we're OK with that.
            // Just trying to guard against multiple threads reading in the variables at the same time.
            lock (_msg.SyncLock)
            {
                int pos;
                _msg.ReadRemainingLength(out pos);

                _topicName = Frame.DecodeString(_msg.MsgBuffer, ref pos);

                if (QualityOfService == QualityOfService.AtLeastOnce || QualityOfService == QualityOfService.ExactlyOnce)
                {
                    _messageId = Frame.DecodeInt16(_msg.MsgBuffer, ref pos);
                }

                _msg.VariableHeaderRead = true;
                _payloadIndex           = pos;
                return(pos);
            }
        }
예제 #4
0
        private int ReadVariableHeader()
        {
            // Variable header could potentially be read by more than one thread but we're OK with that.
            // Just trying to guard against multiple threads reading in the variables at the same time.
            lock (_msg.SyncLock)
            {
                int pos;
                _msg.ReadRemainingLength(out pos);
                byte b1 = _msg.MsgBuffer[pos++];    // Skip past reserved header byte
                byte b2 = _msg.MsgBuffer[pos++];

                if (b2 < (byte)ConnectReturnCode.Unknown)
                {
                    _connectReturnCode = (ConnectReturnCode)b2;
                }
                else
                {
                    _connectReturnCode = ConnectReturnCode.Unknown;
                }

                _msg.VariableHeaderRead = true;
                return(pos);
            }
        }