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

Always call writeGSO

Summary: There's no need to call write when there's only one packet, since write just wraps writeGSO. This simplifies the use of options and will allow for setting a TXTIME when there's only one packet to send.

Reviewed By: kvtsoy

Differential Revision: D48526018

fbshipit-source-id: d934ddce8d3a35febb58ff253fc7a9bed3ef975c
This commit is contained in:
Matt Joras
2023-08-21 16:13:38 -07:00
committed by Facebook GitHub Bot
parent 646bd89e65
commit df49cb664f
3 changed files with 26 additions and 22 deletions

View File

@@ -4351,10 +4351,11 @@ TEST_F(QuicTransportFunctionsTest, WriteWithInplaceBuilder) {
auto stream = conn->streamManager->createNextBidirectionalStream().value();
auto buf = folly::IOBuf::copyBuffer("Andante in C minor");
writeDataToQuicStream(*stream, buf->clone(), true);
EXPECT_CALL(mockSock, write(_, _))
EXPECT_CALL(mockSock, writeGSO(_, _, _))
.Times(1)
.WillOnce(Invoke([&](const SocketAddress&,
const std::unique_ptr<folly::IOBuf>& sockBuf) {
const std::unique_ptr<folly::IOBuf>& sockBuf,
auto) {
EXPECT_GT(bufPtr->length(), 0);
EXPECT_GE(sockBuf->length(), buf->length());
EXPECT_EQ(sockBuf.get(), bufPtr);
@@ -4499,10 +4500,11 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingWithInplaceBuilder) {
conn->outstandings.packets.front().metadata.encodedSize;
auto outstandingPacketsCount = conn->outstandings.packets.size();
ASSERT_EQ(firstPacketSize, conn->udpSendPacketLen);
EXPECT_CALL(mockSock, write(_, _))
EXPECT_CALL(mockSock, writeGSO(_, _, _))
.Times(1)
.WillOnce(Invoke([&](const folly::SocketAddress&,
const std::unique_ptr<folly::IOBuf>& buf) {
const std::unique_ptr<folly::IOBuf>& buf,
auto) {
EXPECT_FALSE(buf->isChained());
EXPECT_EQ(buf->length(), firstPacketSize);
return buf->length();