示例#1
0
        public DefaultHttp2RemoteFlowController(IHttp2Connection connection, IStreamByteDistributor streamByteDistributor, IHttp2RemoteFlowControllerListener listener)
        {
            if (connection is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.connection);
            }
            if (streamByteDistributor is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.streamByteDistributor);
            }
            _connection            = connection;
            _streamByteDistributor = streamByteDistributor;

            // Add a flow state for the connection.
            _stateKey        = connection.NewKey();
            _connectionState = new FlowState(this, _connection.ConnectionStream);
            _ = connection.ConnectionStream.SetProperty(_stateKey, _connectionState);

            // Monitor may depend upon connectionState, and so initialize after connectionState
            Listener(listener);
            _monitor.WindowSize(_connectionState, _initialWindowSize);

            // Register for notification of new streams.
            connection.AddListener(this);
        }
示例#2
0
 public DefaultHttp2RemoteFlowController(IHttp2Connection connection, IStreamByteDistributor streamByteDistributor)
     : this(connection, streamByteDistributor, null)
 {
 }