1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-08 09:42:06 +03:00

Fire readError and remove readCb only when reliable data has been read

Summary: See title

Reviewed By: afrind

Differential Revision: D67766485

fbshipit-source-id: 7283b438317f7b750e274414790777c7dd1572e9
This commit is contained in:
Aman Sharma
2025-01-16 16:00:15 -08:00
committed by Facebook GitHub Bot
parent 3b04bf1f03
commit 9e8fa06fb7
2 changed files with 38 additions and 1 deletions

View File

@@ -975,6 +975,39 @@ TEST_P(QuicTransportImplTestBase, ReadCallbackDataAvailable) {
transport.reset();
}
TEST_P(QuicTransportImplTestBase, ReliableResetReadCallback) {
auto stream = transport->createBidirectionalStream().value();
NiceMock<MockReadCallback> readCb;
transport->setReadCallback(stream, &readCb);
transport->addDataToStream(
stream,
StreamBuffer(
folly::IOBuf::copyBuffer("this string has 29 characters"), 0));
EXPECT_CALL(readCb, readAvailable(stream));
transport->driveReadCallbacks();
// Simulate receiving a reliable reset with a reliableSize of 29
receiveRstStreamSMHandler(
*transport->getStream(stream),
RstStreamFrame(stream, GenericApplicationErrorCode::UNKNOWN, 100, 29));
// The application hasn't yet read all of the reliable data, so we
// shouldn't fire the readError callback yet.
EXPECT_CALL(readCb, readAvailable(stream));
transport->driveReadCallbacks();
transport->read(stream, 29);
// The application has yet read all of the reliable data, so we should fire
// the readError callback.
EXPECT_CALL(
readCb, readError(stream, IsError(GenericApplicationErrorCode::UNKNOWN)));
transport->driveReadCallbacks();
transport.reset();
}
TEST_P(
QuicTransportImplTestBase,
ReadCallbackDataAvailableWithUnidirPrioritized) {