// TODO actually write settings here. internal Task WriteSettingsAsync(IList <Http3PeerSettings> settings) { _outgoingFrame.PrepareSettings(); var buffer = _outputWriter.GetSpan(2); buffer[0] = (byte)_outgoingFrame.Type; buffer[1] = 0; _outputWriter.Advance(2); return(_outputWriter.FlushAsync().AsTask()); }
internal Task WriteSettingsAsync(List <Http3PeerSetting> settings) { _outgoingFrame.PrepareSettings(); // Calculate how long settings are before allocating. var settingsLength = CalculateSettingsSize(settings); // Call GetSpan with enough room for // - One encoded length int for setting size // - 1 byte for setting type // - settings length var buffer = _outputWriter.GetSpan(settingsLength + VariableLengthIntegerHelper.MaximumEncodedLength + 1); // Length start at 1 for type var totalLength = 1; // Write setting type buffer[0] = (byte)_outgoingFrame.Type; buffer = buffer[1..];