mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-24 04:01:07 +03:00
Add reliable reset functionality to QuicWriteCodec
Summary: In this diff, I'm writing functionality to enable us to write RESET_STREAM_AT frames. You can find the format of the RST_STREAM_AT frame in the [RFC](https://datatracker.ietf.org/doc/html/draft-ietf-quic-reliable-stream-reset-06#name-reset_stream_at-frame). Reviewed By: jbeshay Differential Revision: D64907958 fbshipit-source-id: 55e82278ebd0649dc33c82b472be80893af02509
This commit is contained in:
committed by
Facebook GitHub Bot
parent
67794c5022
commit
568f19c17d
@@ -2122,6 +2122,38 @@ TEST_F(QuicWriteCodecTest, NoSpaceForRst) {
|
||||
EXPECT_EQ(0, writeFrame(rstStreamFrame, pktBuilder));
|
||||
}
|
||||
|
||||
TEST_F(QuicWriteCodecTest, WriteRstStreamAt) {
|
||||
MockQuicPacketBuilder pktBuilder;
|
||||
setupCommonExpects(pktBuilder);
|
||||
StreamId id = 0xBAAD;
|
||||
ApplicationErrorCode errorCode = GenericApplicationErrorCode::UNKNOWN;
|
||||
uint64_t finalSize = 0xF00D;
|
||||
uint64_t reliableSize = 0xF00C;
|
||||
RstStreamFrame rstStreamFrame(id, errorCode, finalSize, reliableSize);
|
||||
auto rstStreamBytesWritten = writeFrame(rstStreamFrame, pktBuilder);
|
||||
|
||||
auto builtOut = std::move(pktBuilder).buildTestPacket();
|
||||
auto regularPacket = builtOut.first;
|
||||
EXPECT_EQ(21, rstStreamBytesWritten);
|
||||
auto& resultRstStreamFrame = *regularPacket.frames[0].asRstStreamFrame();
|
||||
EXPECT_EQ(errorCode, resultRstStreamFrame.errorCode);
|
||||
EXPECT_EQ(id, resultRstStreamFrame.streamId);
|
||||
EXPECT_EQ(finalSize, resultRstStreamFrame.finalSize);
|
||||
EXPECT_EQ(reliableSize, resultRstStreamFrame.reliableSize);
|
||||
|
||||
auto wireBuf = std::move(builtOut.second);
|
||||
BufQueue queue;
|
||||
queue.append(wireBuf->clone());
|
||||
QuicFrame decodedFrame = parseQuicFrame(queue);
|
||||
auto& wireRstStreamFrame = *decodedFrame.asRstStreamFrame();
|
||||
EXPECT_EQ(errorCode, wireRstStreamFrame.errorCode);
|
||||
EXPECT_EQ(id, wireRstStreamFrame.streamId);
|
||||
EXPECT_EQ(finalSize, wireRstStreamFrame.finalSize);
|
||||
EXPECT_EQ(reliableSize, wireRstStreamFrame.reliableSize);
|
||||
// At last, verify there is nothing left in the wire format bytes:
|
||||
EXPECT_EQ(queue.chainLength(), 0);
|
||||
}
|
||||
|
||||
TEST_F(QuicWriteCodecTest, WriteBlockedFrame) {
|
||||
MockQuicPacketBuilder pktBuilder;
|
||||
setupCommonExpects(pktBuilder);
|
||||
|
||||
Reference in New Issue
Block a user