コード例 #1
0
        /// <summary>
        /// The window update ratio is used to determine when a window update must be sent. If the ratio
        /// of bytes processed since the last update has meet or exceeded this ratio then a window update will
        /// be sent. This window update ratio will only be applied to <c>streamId</c>.
        /// <para>Note it is the responsibly of the caller to ensure that the
        /// initial <c>SETTINGS</c> frame is sent before this is called. It would
        /// be considered a <see cref="Http2Error.ProtocolError"/> if a <c>WINDOW_UPDATE</c>
        /// was generated by this method before the initial <c>SETTINGS</c> frame is sent.</para>
        /// </summary>
        /// <param name="stream">the stream for which <paramref name="ratio"/> applies to.</param>
        /// <param name="ratio">the ratio to use when checking if a <c>WINDOW_UPDATE</c> is determined necessary.</param>
        /// <remarks>If a protocol-error occurs while generating <c>WINDOW_UPDATE</c> frames</remarks>
        public void WindowUpdateRatio(IHttp2Stream stream, float ratio)
        {
            Debug.Assert(_ctx is object && _ctx.Executor.InEventLoop);
            CheckValidRatio(ratio);
            IFlowState state = GetState(stream);

            state.WindowUpdateRatio(ratio);
            _ = state.WriteWindowUpdateIfNeeded();
        }
コード例 #2
0
        public void IncrementWindowSize(IHttp2Stream stream, int delta)
        {
            Debug.Assert(_ctx is object && _ctx.Executor.InEventLoop);
            IFlowState state = GetState(stream);

            // Just add the delta to the stream-specific initial window size so that the next time the window
            // expands it will grow to the new initial size.
            state.IncrementInitialStreamWindow(delta);
            _ = state.WriteWindowUpdateIfNeeded();
        }