Exemplo n.º 1
0
 public Task WriteGoAwayAsync(int lastStreamId, Http2ErrorCode errorCode)
 {
     lock (_writeLock)
     {
         _outgoingFrame.PrepareGoAway(lastStreamId, errorCode);
         return(WriteAsync(_outgoingFrame.Raw));
     }
 }
Exemplo n.º 2
0
        /* https://tools.ietf.org/html/rfc7540#section-6.8
         +-+-------------------------------------------------------------+
         |R|                  Last-Stream-ID (31)                        |
         +-+-------------------------------------------------------------+
         |                      Error Code (32)                          |
         +---------------------------------------------------------------+
         |                  Additional Debug Data (*)                    | (not implemented)
         +---------------------------------------------------------------+
         */
        public Task WriteGoAwayAsync(int lastStreamId, Http2ErrorCode errorCode)
        {
            lock (_writeLock)
            {
                _outgoingFrame.PrepareGoAway(lastStreamId, errorCode);
                WriteHeaderUnsynchronized();

                var buffer = _outputWriter.GetSpan(8);
                Bitshifter.WriteUInt31BigEndian(buffer, (uint)lastStreamId);
                buffer = buffer.Slice(4);
                BinaryPrimitives.WriteUInt32BigEndian(buffer, (uint)errorCode);
                _outputWriter.Advance(8);

                return(TimeFlushUnsynchronizedAsync());
            }
        }