mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-07-30 14:43:05 +03:00
Fix Datagram Write in case there is no space in the QUIC packet
Summary: When there is not enough space in the QUIC packet to write a datagram frame, we should not dequeue the datagram Reviewed By: mjoras Differential Revision: D33109603 fbshipit-source-id: 937a5a0ffe55c7f88e39faf224e7ad06ca599708
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cae8a1b705
commit
95ff9198dd
@ -1965,7 +1965,9 @@ TEST_F(QuicPacketSchedulerTest, DatagramFrameSchedulerMultipleFramesPerPacket) {
|
||||
}));
|
||||
NiceMock<MockQuicStats> quicStats;
|
||||
conn.statsCallback = &quicStats;
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_)).Times(2);
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_))
|
||||
.Times(2)
|
||||
.WillRepeatedly(Invoke([](uint64_t bytes) { EXPECT_GT(bytes, 0); }));
|
||||
// Call scheduler
|
||||
auto& frames = builder.frames_;
|
||||
scheduler.writeDatagramFrames(builder);
|
||||
@ -1993,10 +1995,14 @@ TEST_F(QuicPacketSchedulerTest, DatagramFrameSchedulerOneFramePerPacket) {
|
||||
conn.statsCallback = &quicStats;
|
||||
// Call scheduler
|
||||
auto& frames = builder.frames_;
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_)).Times(1);
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(Invoke([](uint64_t bytes) { EXPECT_GT(bytes, 0); }));
|
||||
scheduler.writeDatagramFrames(builder);
|
||||
ASSERT_EQ(frames.size(), 1);
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_)).Times(1);
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(Invoke([](uint64_t bytes) { EXPECT_GT(bytes, 0); }));
|
||||
scheduler.writeDatagramFrames(builder);
|
||||
ASSERT_EQ(frames.size(), 2);
|
||||
}
|
||||
@ -2025,7 +2031,9 @@ TEST_F(QuicPacketSchedulerTest, DatagramFrameWriteWhenRoomAvailable) {
|
||||
ASSERT_EQ(frames.size(), 0);
|
||||
EXPECT_CALL(builder, remainingSpaceInPkt())
|
||||
.WillRepeatedly(Return(conn.udpSendPacketLen / 2));
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_)).Times(1);
|
||||
EXPECT_CALL(quicStats, onDatagramWrite(_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(Invoke([](uint64_t bytes) { EXPECT_GT(bytes, 0); }));
|
||||
scheduler.writeDatagramFrames(builder);
|
||||
ASSERT_EQ(frames.size(), 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user