예제 #1
0
 /// <summary>
 /// ストリームリストから <see cref="Http2StreamReader"/> を削除
 /// </summary>
 /// <param name="reader">削除する <see cref="Http2StreamReader"/></param>
 private void RemoveStreamReader(Http2StreamReader reader)
 {
     reader.PushPromise                -= this.OnPushPromise;
     reader.HttpRequestSent            -= this.OnHttpRequestSent;
     reader.HttpResponseSent           -= this.OnHttpResponseSent;
     reader.ClientWebSocketMessageSent -= this.OnClientWebSocketMessageSent;
     reader.ServerWebSocketMessageSent -= this.OnServerWebSocketMessageSent;
     reader.Reset -= this.OnResetStream;
     this.streams.TryRemove(reader.Id, out _);
 }
예제 #2
0
        /// <summary>
        /// ストリームリストに新規の <see cref="Http2StreamReader"/> を追加
        /// </summary>
        /// <param name="frame">フレーム</param>
        private void AddStreamReader(IHttp2Frame frame)
        {
            Http2StreamReader reader;

            if (this.pushPromises.TryRemove(frame.Header.StreamID, out var request))
            {
                this.HttpRequestSent?.Invoke(request);
                // PUSH_PROMISE による予約済みストリーム
                reader = new Http2StreamReader(frame.Header.StreamID, this.requestHpackDecoder, this.responseHpackDecoder, this.maxCaptureSize, request);
            }
            else
            {
                // 通常のストリーム
                reader = new Http2StreamReader(frame.Header.StreamID, this.requestHpackDecoder, this.responseHpackDecoder, this.maxCaptureSize);
            }
            reader.PushPromise                += this.OnPushPromise;
            reader.HttpRequestSent            += this.OnHttpRequestSent;
            reader.HttpResponseSent           += this.OnHttpResponseSent;
            reader.ClientWebSocketMessageSent += this.OnClientWebSocketMessageSent;
            reader.ServerWebSocketMessageSent += this.OnServerWebSocketMessageSent;
            reader.Reset += this.OnResetStream;
            this.streams.TryAdd(frame.Header.StreamID, reader);
        }