public Task WriteRstStreamAsync(int streamId, Http2ErrorCode errorCode) { lock (_writeLock) { _outgoingFrame.PrepareRstStream(streamId, errorCode); return(WriteAsync(_outgoingFrame.Raw)); } }
/* https://tools.ietf.org/html/rfc7540#section-6.4 +---------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+ */ public Task WriteRstStreamAsync(int streamId, Http2ErrorCode errorCode) { lock (_writeLock) { if (_completed) { return(Task.CompletedTask); } _outgoingFrame.PrepareRstStream(streamId, errorCode); WriteHeaderUnsynchronized(); var buffer = _outputWriter.GetSpan(4); BinaryPrimitives.WriteUInt32BigEndian(buffer, (uint)errorCode); _outputWriter.Advance(4); return(TimeFlushUnsynchronizedAsync()); } }