OpenServer() private method

private OpenServer ( ProtocolHeaders headers, bool isFin ) : void
headers ProtocolHeaders
isFin bool
return void
コード例 #1
0
        /// <summary>
        /// Opens the stream in current session.
        /// </summary>
        /// <param name="id">the stream id.</param>
        /// <param name="headers">The S+M headers.</param>
        /// <param name="isFinal">the final flag.</param>
        /// <returns>The Stream.</returns>
        private Http2Stream OpenStream(int id, ProtocolHeaders headers, bool isFinal)
        {
            if (id <= this.lastSeenStreamId)
            {
                this.End(StatusCode.ProtocolError);
                return(null);
            }

            this.lastSeenStreamId = id;

            // don't have to wait for stream opening
            Http2Stream stream = new Http2Stream(id, this);

            this.streams.Add(stream);

            stream.OnClose += this.OnCloseStream;
            if (IsServer)
            {
                stream.OpenServer(headers, isFinal);

                // Settings must be sent for session once for session
                if (stream.StreamId <= 2)
                {
                    this.protocol.SendSettings(stream);
                }

                this.protocol.SendSynReply(stream);
            }
            else
            {
                stream.OpenClient(headers, isFinal);
            }

            if (this.OnStreamOpened != null)
            {
                this.OnStreamOpened(this, new StreamEventArgs(stream));
            }

            return(stream);
        }
コード例 #2
0
        /// <summary>
        /// Opens the stream in current session.
        /// </summary>
        /// <param name="id">the stream id.</param>
        /// <param name="headers">The S+M headers.</param>
        /// <param name="isFinal">the final flag.</param>
        /// <returns>The Stream.</returns>
        private Http2Stream OpenStream(int id, ProtocolHeaders headers, bool isFinal)
        {
            if (id <= this.lastSeenStreamId)
            {
                this.End(StatusCode.ProtocolError);
                return null;
            }

            this.lastSeenStreamId = id;

            // don't have to wait for stream opening
            Http2Stream stream = new Http2Stream(id, this);

            this.streams.Add(stream);

            stream.OnClose += this.OnCloseStream;
            if (IsServer)
            {
                stream.OpenServer(headers, isFinal);

                // Settings must be sent for session once for session
                if (stream.StreamId <= 2)
                    this.protocol.SendSettings(stream);

                this.protocol.SendSynReply(stream);
            }
            else
            {
                stream.OpenClient(headers, isFinal);
            }

            if (this.OnStreamOpened != null)
            {
                this.OnStreamOpened(this, new StreamEventArgs(stream));
            }

            return stream;
        }