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

Use correct value for messageSizes in SendmmsgInplacePacketBatchWriter

Summary: `messageSizes` is supposed to be the number of iovecs in each message, and not the length of the iovec. This was causing crashes in Edgeray (T215909454).

Reviewed By: jbeshay

Differential Revision: D70129535

fbshipit-source-id: 6d79e6ac0789402674e753297984b3691d371338
This commit is contained in:
Aman Sharma
2025-02-25 08:40:14 -08:00
committed by Facebook GitHub Bot
parent d119184a1e
commit 71b4e1c613
2 changed files with 4 additions and 2 deletions

View File

@@ -282,7 +282,7 @@ ssize_t SendmmsgInplacePacketBatchWriter::write(
std::array<size_t, kMaxIovecs> messageSizes{};
for (size_t i = 0; i < numPacketsBuffered_; i++) {
messageSizes[i] = iovecs_[i].iov_len;
messageSizes[i] = 1;
}
sock.writem(

View File

@@ -400,6 +400,8 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgInplace) {
std::make_shared<FollyQuicEventBase>(&evb);
quic::test::MockAsyncUDPSocket sock(qEvb);
gsoSupported_ = false;
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_SENDMMSG,
kBatchNum,
@@ -452,7 +454,7 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgInplace) {
EXPECT_EQ(count, kBatchNum);
for (size_t k = 0; k < count; k++) {
EXPECT_EQ(messageSizes[k], expectedIovecs[k].iov_len);
EXPECT_EQ(messageSizes[k], 1);
EXPECT_EQ(expectedIovecs[k].iov_base, iovecs[k].iov_base);
EXPECT_EQ(expectedIovecs[k].iov_len, iovecs[k].iov_len);
}