private Task ProcessPingFrameAsync() { if (_currentHeadersStream != null) { throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorHeadersInterleaved(_incomingFrame.Type, _incomingFrame.StreamId, _currentHeadersStream.StreamId), Http2ErrorCode.PROTOCOL_ERROR); } if (_incomingFrame.StreamId != 0) { throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorStreamIdNotZero(_incomingFrame.Type), Http2ErrorCode.PROTOCOL_ERROR); } if (_incomingFrame.Length != 8) { throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorUnexpectedFrameLength(_incomingFrame.Type, 8), Http2ErrorCode.FRAME_SIZE_ERROR); } if ((_incomingFrame.PingFlags & Http2PingFrameFlags.ACK) == Http2PingFrameFlags.ACK) { // TODO: verify that payload is equal to the outgoing PING frame return(Task.CompletedTask); } return(_frameWriter.WritePingAsync(Http2PingFrameFlags.ACK, _incomingFrame.Payload)); }
private Task ProcessPingFrameAsync() { if (_currentHeadersStream != null) { throw new Http2ConnectionErrorException(Http2ErrorCode.PROTOCOL_ERROR); } if (_incomingFrame.StreamId != 0) { throw new Http2ConnectionErrorException(Http2ErrorCode.PROTOCOL_ERROR); } if (_incomingFrame.Length != 8) { throw new Http2ConnectionErrorException(Http2ErrorCode.FRAME_SIZE_ERROR); } if ((_incomingFrame.PingFlags & Http2PingFrameFlags.ACK) == Http2PingFrameFlags.ACK) { return(Task.CompletedTask); } return(_frameWriter.WritePingAsync(Http2PingFrameFlags.ACK, _incomingFrame.Payload)); }