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

Log an error when we write a packet larger than limit

Summary: as title

Reviewed By: bschlinker

Differential Revision: D22542572

fbshipit-source-id: 4f53a1c916b22e33f183208efb671c1d0883309c
This commit is contained in:
Yang Chi
2020-07-15 11:17:45 -07:00
committed by Facebook GitHub Bot
parent 6d443efc69
commit a7dc8cb4f7
3 changed files with 12 additions and 36 deletions

View File

@@ -624,39 +624,6 @@ TEST_P(QuicBatchWriterTest, InplaceWriterBufResidueCheck) {
EXPECT_EQ(0, rawBuf->headroom());
}
TEST_P(QuicBatchWriterTest, InplaceWriterBufResidueTooBig) {
bool useThreadLocal = GetParam();
folly::EventBase evb;
folly::test::MockAsyncUDPSocket sock(&evb);
EXPECT_CALL(sock, getGSO()).WillRepeatedly(Return(1));
uint32_t batchSize = 20;
auto bufAccessor =
std::make_unique<SimpleBufAccessor>(conn_.udpSendPacketLen * batchSize);
conn_.bufAccessor = bufAccessor.get();
conn_.udpSendPacketLen = 1000;
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
sock,
quic::QuicBatchingMode::BATCHING_MODE_GSO,
batchSize,
useThreadLocal,
quic::kDefaultThreadLocalDelay,
DataPathType::ContinuousMemory,
conn_);
auto buf = bufAccessor->obtain();
folly::IOBuf* rawBuf = buf.get();
bufAccessor->release(std::move(buf));
rawBuf->append(700);
ASSERT_FALSE(
batchWriter->append(nullptr, 700, folly::SocketAddress(), nullptr));
size_t packetSizeTooBig = 1090;
rawBuf->append(packetSizeTooBig);
EXPECT_TRUE(batchWriter->needsFlush(packetSizeTooBig));
EXPECT_DEATH(batchWriter->write(sock, folly::SocketAddress()), "");
}
INSTANTIATE_TEST_CASE_P(
QuicBatchWriterTest,
QuicBatchWriterTest,