public virtual void RemoteSettings(Http2Settings settings) { var pushEnabled = settings.PushEnabled(); var config = Configuration; var outboundHeaderConfig = config.HeadersConfiguration; var outboundFrameSizePolicy = config.FrameSizePolicy; if (pushEnabled.HasValue) { if (!_connection.IsServer && pushEnabled.Value) { ThrowHelper.ThrowConnectionError_ClientReceivedAValueOfEnablePushSpecifiedToOtherThan0(); } _connection.Remote.AllowPushTo(pushEnabled.Value); } var maxConcurrentStreams = settings.MaxConcurrentStreams(); if (maxConcurrentStreams.HasValue) { _connection.Local.SetMaxActiveStreams((int)Math.Min(maxConcurrentStreams.Value, int.MaxValue)); } var headerTableSize = settings.HeaderTableSize(); if (headerTableSize.HasValue) { outboundHeaderConfig.SetMaxHeaderTableSize((int)Math.Min(headerTableSize.Value, int.MaxValue)); } var maxHeaderListSize = settings.MaxHeaderListSize(); if (maxHeaderListSize.HasValue) { outboundHeaderConfig.SetMaxHeaderListSize(maxHeaderListSize.Value); } var maxFrameSize = settings.MaxFrameSize(); if (maxFrameSize.HasValue) { outboundFrameSizePolicy.SetMaxFrameSize(maxFrameSize.Value); } var initialWindowSize = settings.InitialWindowSize(); if (initialWindowSize.HasValue) { FlowController.SetInitialWindowSize(initialWindowSize.Value); } }
public virtual Task WriteSettingsAsync(IChannelHandlerContext ctx, Http2Settings settings, IPromise promise) { _outstandingLocalSettingsQueue.AddLast(settings); try { var pushEnabled = settings.PushEnabled(); if (pushEnabled.HasValue && _connection.IsServer) { ThrowHelper.ThrowConnectionError_ServerSendingSettintsFrameWithEnablePushSpecified(); } } catch (Exception e) { promise.SetException(e); return(promise.Task); } return(_frameWriter.WriteSettingsAsync(ctx, settings, promise)); }