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

Change Buf -> BufPtr and RawBuf -> Buf

Summary:
Previously,
* `RawBuf` was a typealias for `std::unique_ptr<folly::IOBuf>`
* `Buf` was a typealias for `folly::IOBuf`

In this diff,
* `Buf` is a typealias for `folly::IOBuf`
* `BufPtr` is a typealias for `std::unique_ptr<folly::IOBuf>`

Reviewed By: hanidamlaj

Differential Revision: D73206576

fbshipit-source-id: 454bf6ccfce3d6571e5e931889263ed98cc24af3
This commit is contained in:
Aman Sharma
2025-04-21 20:14:02 -07:00
committed by Facebook GitHub Bot
parent 153668148e
commit 41667ff7c5
108 changed files with 533 additions and 515 deletions

View File

@@ -350,7 +350,7 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgNewlyAllocatedIovecMatches) {
CHECK(batchWriter->empty());
CHECK_EQ(batchWriter->size(), 0);
std::vector<Buf> buffers;
std::vector<BufPtr> buffers;
size_t size = 0;
for (auto& message : messages) {
@@ -1188,15 +1188,15 @@ TEST_F(QuicBatchWriterTest, InplaceWriterBufResidueCheck) {
conn_,
gsoSupported_);
auto buf = bufAccessor->obtain();
folly::IOBuf* rawBuf = buf.get();
folly::IOBuf* Buf = buf.get();
bufAccessor->release(std::move(buf));
rawBuf->append(700);
Buf->append(700);
ASSERT_FALSE(
batchWriter->append(nullptr, 700, folly::SocketAddress(), nullptr));
// There is a check against packet 10 bytes or more larger than the size limit
size_t packetSizeBig = 1009;
rawBuf->append(packetSizeBig);
Buf->append(packetSizeBig);
EXPECT_TRUE(batchWriter->needsFlush(packetSizeBig));
EXPECT_CALL(sock, writeGSO(_, _, _, _))
@@ -1208,8 +1208,8 @@ TEST_F(QuicBatchWriterTest, InplaceWriterBufResidueCheck) {
}));
// No crash:
EXPECT_EQ(700, batchWriter->write(sock, folly::SocketAddress()));
EXPECT_EQ(1009, rawBuf->length());
EXPECT_EQ(0, rawBuf->headroom());
EXPECT_EQ(1009, Buf->length());
EXPECT_EQ(0, Buf->headroom());
}
class SinglePacketInplaceBatchWriterTest : public ::testing::Test {
@@ -1290,13 +1290,13 @@ TEST_F(SinglePacketInplaceBatchWriterTest, TestReset) {
CHECK(dynamic_cast<quic::SinglePacketInplaceBatchWriter*>(batchWriter.get()));
auto buf = bufAccessor_->obtain();
folly::IOBuf* rawBuf = buf.get();
folly::IOBuf* Buf = buf.get();
bufAccessor_->release(std::move(buf));
rawBuf->append(700);
Buf->append(700);
EXPECT_EQ(rawBuf->computeChainDataLength(), 700);
EXPECT_EQ(Buf->computeChainDataLength(), 700);
batchWriter->reset();
EXPECT_EQ(rawBuf->computeChainDataLength(), 0);
EXPECT_EQ(Buf->computeChainDataLength(), 0);
}
TEST_F(SinglePacketInplaceBatchWriterTest, TestAppend) {
@@ -1319,11 +1319,11 @@ TEST_F(SinglePacketInplaceBatchWriterTest, TestEmpty) {
EXPECT_TRUE(batchWriter->empty());
auto buf = bufAccessor_->obtain();
folly::IOBuf* rawBuf = buf.get();
folly::IOBuf* Buf = buf.get();
bufAccessor_->release(std::move(buf));
rawBuf->append(700);
Buf->append(700);
EXPECT_EQ(rawBuf->computeChainDataLength(), 700);
EXPECT_EQ(Buf->computeChainDataLength(), 700);
EXPECT_FALSE(batchWriter->empty());
batchWriter->reset();
@@ -1339,12 +1339,12 @@ TEST_F(SinglePacketInplaceBatchWriterTest, TestWrite) {
EXPECT_TRUE(batchWriter->empty());
auto buf = bufAccessor_->obtain();
folly::IOBuf* rawBuf = buf.get();
folly::IOBuf* Buf = buf.get();
bufAccessor_->release(std::move(buf));
const auto appendSize = conn_.udpSendPacketLen - 200;
rawBuf->append(appendSize);
Buf->append(appendSize);
EXPECT_EQ(rawBuf->computeChainDataLength(), appendSize);
EXPECT_EQ(Buf->computeChainDataLength(), appendSize);
EXPECT_FALSE(batchWriter->empty());
folly::EventBase evb;