Пример #1
0
        /// <summary>
        /// Called when frame receives by the listener.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="FrameReceivedEventArgs"/> instance containing the event data.</param>
        protected void OnFrameReceivedHandler(object sender, FrameReceivedEventArgs args)
        {
            var stream = args.Stream;
            var frame = args.Frame;

            switch (frame.FrameType)
            {
                case FrameType.Headers:
                    if (ForbiddenHeaders.HasForbiddenHeader(stream.Headers))
                    {
                        stream.WriteRst(ResetStatusCode.ProtocolError);
                        return;
                    }
                    ProcessRequest(stream, frame);
                    break;
                case FrameType.Data:
                    ProcessIncomingData(stream, frame);
                    break;
                case FrameType.Settings:
                    ProcessSettings(frame as SettingsFrame);
                    break;
            }
        }
        /// <summary>
        /// Called when frame receives by the listener.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="FrameReceivedEventArgs"/> instance containing the event data.</param>
        protected void OnFrameReceivedHandler(object sender, FrameReceivedEventArgs args)
        {
            var stream = args.Stream;
            var frame = args.Frame;

            switch (frame.FrameType)
            {
                case FrameType.Headers:
                    ProcessRequest(stream, frame);
                    break;
                case FrameType.Data:
                    ProcessIncomingData(stream, frame);
                    break;
            }
        }