Пример #1
0
 public Task WriteSettingsAsync(IList <Http2PeerSetting> settings)
 {
     lock (_writeLock)
     {
         _outgoingFrame.PrepareSettings(Http2SettingsFrameFlags.NONE, settings);
         return(WriteFrameUnsynchronizedAsync());
     }
 }
Пример #2
0
 public Task WriteSettingsAsync(Http2PeerSettings settings)
 {
     lock (_writeLock)
     {
         // TODO: actually send settings
         _outgoingFrame.PrepareSettings(Http2SettingsFrameFlags.NONE);
         return(WriteAsync(_outgoingFrame.Raw));
     }
 }
Пример #3
0
        /* https://tools.ietf.org/html/rfc7540#section-6.5.1
         *  List of:
         +-------------------------------+
         |       Identifier (16)         |
         +-------------------------------+-------------------------------+
         |                        Value (32)                             |
         +---------------------------------------------------------------+
         */
        public Task WriteSettingsAsync(IList <Http2PeerSetting> settings)
        {
            lock (_writeLock)
            {
                if (_completed)
                {
                    return(Task.CompletedTask);
                }

                _outgoingFrame.PrepareSettings(Http2SettingsFrameFlags.NONE);
                var settingsSize = settings.Count * Http2FrameReader.SettingSize;
                _outgoingFrame.PayloadLength = settingsSize;
                WriteHeaderUnsynchronized();

                var buffer = _outputWriter.GetSpan(settingsSize).Slice(0, settingsSize); // GetSpan isn't precise
                WriteSettings(settings, buffer);
                _outputWriter.Advance(settingsSize);

                return(TimeFlushUnsynchronizedAsync());
            }
        }