Exemplo n.º 1
0
        /// <summary>
        /// Send control packet
        /// </summary>
        /// <param name="flags">SMUX header flags</param>
        private void SendControlPacket(SNISMUXFlags flags)
        {
            SNIPacket packet = new SNIPacket(headerSize: SNISMUXHeader.HEADER_LENGTH, dataSize: 0);

            lock (this)
            {
                SetupSMUXHeader(0, flags);
                _currentHeader.Write(packet.GetHeaderBuffer(SNISMUXHeader.HEADER_LENGTH));
                packet.SetHeaderActive();
            }
            _connection.Send(packet);
        }
Exemplo n.º 2
0
        private void GetSMUXHeaderBytes(int length, SNISMUXFlags flags, Span <byte> bytes)
        {
            _currentHeader.SMID           = 83;
            _currentHeader.flags          = (byte)flags;
            _currentHeader.sessionId      = _sessionId;
            _currentHeader.length         = (uint)SNISMUXHeader.HEADER_LENGTH + (uint)length;
            _currentHeader.sequenceNumber = ((flags == SNISMUXFlags.SMUX_FIN) || (flags == SNISMUXFlags.SMUX_ACK)) ? _sequenceNumber - 1 : _sequenceNumber++;
            _currentHeader.highwater      = _receiveHighwater;
            _receiveHighwaterLastAck      = _currentHeader.highwater;

            _currentHeader.Write(bytes);
        }