diff --git a/quic/api/QuicGsoBatchWriters.cpp b/quic/api/QuicGsoBatchWriters.cpp index 910f9c439..81e140d0a 100644 --- a/quic/api/QuicGsoBatchWriters.cpp +++ b/quic/api/QuicGsoBatchWriters.cpp @@ -51,7 +51,7 @@ bool GSOPacketBatchWriter::append( // now we've got an additional buffer // append it to the chain - buf_->prependChain(std::move(buf)); + buf_->appendToChain(std::move(buf)); currBufs_++; // see if we've added a different size @@ -252,7 +252,7 @@ bool SendmmsgGSOPacketBatchWriter::append( // we can append options_[idx].gso = prevSize_[idx]; prevSize_[idx] = size; - bufs_[idx]->prependChain(std::move(buf)); + bufs_[idx]->appendToChain(std::move(buf)); currBufs_++; // flush if we reach maxBufs_ diff --git a/quic/api/QuicTransportFunctions.cpp b/quic/api/QuicTransportFunctions.cpp index d1e07a94e..2bbfff26d 100644 --- a/quic/api/QuicTransportFunctions.cpp +++ b/quic/api/QuicTransportFunctions.cpp @@ -1441,7 +1441,7 @@ void writeCloseCommon( bufUniquePtr->length(), headerCipher); folly::IOBuf packetBuf(std::move(packet.header)); - packetBuf.prependChain(std::move(bufUniquePtr)); + packetBuf.appendToChain(std::move(bufUniquePtr)); auto packetSize = packetBuf.computeChainDataLength(); if (connection.qLogger) { connection.qLogger->addPacket(packet.packet, packetSize); diff --git a/quic/api/test/QuicTransportFunctionsTest.cpp b/quic/api/test/QuicTransportFunctionsTest.cpp index 2df66e6d4..3390d2aca 100644 --- a/quic/api/test/QuicTransportFunctionsTest.cpp +++ b/quic/api/test/QuicTransportFunctionsTest.cpp @@ -3285,7 +3285,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldData) { EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _)) .WillRepeatedly(Invoke([&](auto& buf, auto, auto) { if (buf) { - pktBodyCaptured.prependChain(buf->clone()); + pktBodyCaptured.appendToChain(buf->clone()); return buf->clone(); } else { return folly::IOBuf::create(0); @@ -3299,7 +3299,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldData) { EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _)) .WillRepeatedly(Invoke([&](auto& buf, auto, auto) { if (buf) { - secondBodyCaptured.prependChain(buf->clone()); + secondBodyCaptured.appendToChain(buf->clone()); return buf->clone(); } else { return folly::IOBuf::create(0); @@ -3332,7 +3332,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldDataAckFreq) { EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _)) .WillRepeatedly(Invoke([&](auto& buf, auto, auto) { if (buf) { - pktBodyCaptured.prependChain(buf->clone()); + pktBodyCaptured.appendToChain(buf->clone()); return buf->clone(); } else { return folly::IOBuf::create(0); @@ -3352,7 +3352,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldDataAckFreq) { EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _)) .WillRepeatedly(Invoke([&](auto& buf, auto, auto) { if (buf) { - secondBodyCaptured.prependChain(buf->clone()); + secondBodyCaptured.appendToChain(buf->clone()); return buf->clone(); } else { return folly::IOBuf::create(0); diff --git a/quic/api/test/QuicTypedTransportTest.cpp b/quic/api/test/QuicTypedTransportTest.cpp index 452ce9db6..6e4f996a0 100644 --- a/quic/api/test/QuicTypedTransportTest.cpp +++ b/quic/api/test/QuicTypedTransportTest.cpp @@ -1073,7 +1073,7 @@ TYPED_TEST( this->getTransport()->writeChain(streamId, data2->clone(), false); const auto maybeWrittenPackets2 = this->loopForWrites(); - data1->prependChain(std::move(data2)); + data1->appendToChain(std::move(data2)); auto combined = std::move(data1); // should have sent two packets diff --git a/quic/codec/test/QuicPacketBuilderTest.cpp b/quic/codec/test/QuicPacketBuilderTest.cpp index 123e92da1..ba53f6827 100644 --- a/quic/codec/test/QuicPacketBuilderTest.cpp +++ b/quic/codec/test/QuicPacketBuilderTest.cpp @@ -31,7 +31,7 @@ BufPtr packetToBuf( // This does not matter. PacketNum num = 10; if (!packet.header.empty()) { - buf->prependChain(packet.header.clone()); + buf->appendToChain(packet.header.clone()); } std::unique_ptr body = folly::IOBuf::create(0); if (!packet.body.empty()) { @@ -43,7 +43,7 @@ BufPtr packetToBuf( EXPECT_GT(body->computeChainDataLength(), bodySize); } if (body) { - buf->prependChain(std::move(body)); + buf->appendToChain(std::move(body)); } return buf; } @@ -296,7 +296,7 @@ TEST_P(QuicPacketBuilderTest, EnforcePacketSizeWithCipherOverhead) { auto overhead = folly::IOBuf::create(1000); overhead->append(cipherOverhead); auto clone = buf->clone(); - clone->prependChain(std::move(overhead)); + clone->appendToChain(std::move(overhead)); return std::move(clone); })); diff --git a/quic/common/BufUtil.cpp b/quic/common/BufUtil.cpp index dd0b50a16..7e2e0b6b3 100644 --- a/quic/common/BufUtil.cpp +++ b/quic/common/BufUtil.cpp @@ -129,7 +129,7 @@ void BufQueue::appendToChain(BufPtr& dst, BufPtr&& src) { if (dst == nullptr) { dst = std::move(src); } else { - dst->prependChain(std::move(src)); + dst->appendToChain(std::move(src)); } } @@ -140,7 +140,7 @@ void BufAppender::push(const uint8_t* data, size_t len) { if (crtBuf_->tailroom() < len || lastBufShared_) { auto newBuf = BufHelpers::createCombined(std::max(appendLen_, len)); Buf* newBufPtr = newBuf.get(); - head_->prependChain(std::move(newBuf)); + head_->appendToChain(std::move(newBuf)); crtBuf_ = newBufPtr; } memcpy(crtBuf_->writableTail(), data, len); @@ -155,7 +155,7 @@ void BufAppender::insert(BufPtr data) { // If the buffer is shared we do not want to overrwrite the tail of the // buffer. lastBufShared_ = data->isShared(); - head_->prependChain(std::move(data)); + head_->appendToChain(std::move(data)); crtBuf_ = dataPtr; } diff --git a/quic/common/NetworkData.h b/quic/common/NetworkData.h index 5d0c24d13..a7c90e15c 100644 --- a/quic/common/NetworkData.h +++ b/quic/common/NetworkData.h @@ -152,7 +152,7 @@ struct NetworkData { BufPtr buf; for (auto& packet : packets_) { if (buf) { - buf->prependChain(packet.buf.move()); + buf->appendToChain(packet.buf.move()); } else { buf = packet.buf.move(); } diff --git a/quic/common/test/AeadTestUtil.cpp b/quic/common/test/AeadTestUtil.cpp index 22ceeafdd..702b86952 100644 --- a/quic/common/test/AeadTestUtil.cpp +++ b/quic/common/test/AeadTestUtil.cpp @@ -44,14 +44,14 @@ chunkIOBuf(std::unique_ptr input, size_t chunks, BufCreator creator) { if (!chunked) { chunked = std::move(buf); } else { - chunked->prependChain(std::move(buf)); + chunked->appendToChain(std::move(buf)); } } size_t remainLen = inputLen - (chunks - 1) * chunkLen; auto remain = creator(remainLen, chunks - 1); remain->append(remainLen); - chunked->prependChain(std::move(remain)); + chunked->appendToChain(std::move(remain)); transformBuffer( *input, *chunked, [](uint8_t* out, const uint8_t* in, size_t len) { diff --git a/quic/common/test/BufAccessorTest.cpp b/quic/common/test/BufAccessorTest.cpp index 24c148db3..523c57360 100644 --- a/quic/common/test/BufAccessorTest.cpp +++ b/quic/common/test/BufAccessorTest.cpp @@ -33,7 +33,7 @@ TEST(BufAccessor, CapacityMatch) { TEST(BufAccessor, RefuseChainedBuf) { BufAccessor accessor(1000); auto buf = accessor.obtain(); - buf->prependChain(folly::IOBuf::create(0)); + buf->appendToChain(folly::IOBuf::create(0)); EXPECT_DEATH(accessor.release(std::move(buf)), ""); } } // namespace quic diff --git a/quic/common/test/BufUtilTest.cpp b/quic/common/test/BufUtilTest.cpp index 256af2643..f6b42c068 100644 --- a/quic/common/test/BufUtilTest.cpp +++ b/quic/common/test/BufUtilTest.cpp @@ -427,9 +427,9 @@ TEST(BufWriterTest, InsertChain) { BufWriter writer(testBuffer->writableTail(), 1000); auto inputBuffer = folly::IOBuf::copyBuffer("Cause I lost you and now what am i to do?"); - inputBuffer->prependChain( + inputBuffer->appendToChain( folly::IOBuf::copyBuffer(" Can't believe that we are through.")); - inputBuffer->prependChain( + inputBuffer->appendToChain( folly::IOBuf::copyBuffer(" While the memory of you linger like a song.")); auto len = inputBuffer->computeChainDataLength(); writer.insert(inputBuffer.get()); @@ -598,9 +598,9 @@ TEST(BufWriterTest, InsertChainByteChainedRange) { BufWriter writer(testBuffer->writableTail(), 1000); auto inputBuffer = folly::IOBuf::copyBuffer("Cause I lost you and now what am i to do?"); - inputBuffer->prependChain( + inputBuffer->appendToChain( folly::IOBuf::copyBuffer(" Can't believe that we are through.")); - inputBuffer->prependChain( + inputBuffer->appendToChain( folly::IOBuf::copyBuffer(" While the memory of you linger like a song.")); auto len = inputBuffer->computeChainDataLength(); ChainedByteRangeHead cbrh(inputBuffer); diff --git a/quic/common/test/TestUtils.cpp b/quic/common/test/TestUtils.cpp index c761f11e9..b4797c3e7 100644 --- a/quic/common/test/TestUtils.cpp +++ b/quic/common/test/TestUtils.cpp @@ -406,7 +406,7 @@ RegularQuicPacketBuilder::Packet createCryptoPacket( BufPtr packetToBuf(const RegularQuicPacketBuilder::Packet& packet) { auto packetBuf = packet.header.clone(); if (!packet.body.empty()) { - packetBuf->prependChain(packet.body.clone()); + packetBuf->appendToChain(packet.body.clone()); } return packetBuf; } @@ -436,7 +436,7 @@ BufPtr packetToBufCleartext( packet.header.coalesce(); auto tagLen = cleartextCipher.getCipherOverhead(); if (body->tailroom() < tagLen) { - body->prependChain(folly::IOBuf::create(tagLen)); + body->appendToChain(folly::IOBuf::create(tagLen)); } body->coalesce(); auto encryptedBody = cleartextCipher.inplaceEncrypt( @@ -449,7 +449,7 @@ BufPtr packetToBufCleartext( encryptedBody->data(), encryptedBody->length(), headerCipher); - packetBuf->prependChain(std::move(encryptedBody)); + packetBuf->appendToChain(std::move(encryptedBody)); return packetBuf; } diff --git a/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp b/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp index 36ffaeac5..6c653a6be 100644 --- a/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp +++ b/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp @@ -216,13 +216,13 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> { BufPtr getHandshakeWriteBytes() { auto buf = folly::IOBuf::create(0); if (!cryptoState->initialStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->initialStream.writeBuffer.move()); + buf->appendToChain(cryptoState->initialStream.writeBuffer.move()); } if (!cryptoState->handshakeStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->handshakeStream.writeBuffer.move()); + buf->appendToChain(cryptoState->handshakeStream.writeBuffer.move()); } if (!cryptoState->oneRttStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->oneRttStream.writeBuffer.move()); + buf->appendToChain(cryptoState->oneRttStream.writeBuffer.move()); } return buf; } diff --git a/quic/fizz/client/test/QuicClientTransportTest.cpp b/quic/fizz/client/test/QuicClientTransportTest.cpp index 9f973e078..45633ac34 100644 --- a/quic/fizz/client/test/QuicClientTransportTest.cpp +++ b/quic/fizz/client/test/QuicClientTransportTest.cpp @@ -353,7 +353,7 @@ TEST_P(QuicClientTransportIntegrationTest, NetworkTest) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); } @@ -374,7 +374,7 @@ TEST_P(QuicClientTransportIntegrationTest, FlowControlLimitedTest) { memset(data->writableData(), 'a', data->length()); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); } @@ -450,7 +450,7 @@ TEST_P(QuicClientTransportIntegrationTest, NetworkTestConnected) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); } @@ -472,7 +472,7 @@ TEST_P(QuicClientTransportIntegrationTest, SetTransportSettingsAfterStart) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); settings.connectUDP = false; client->setTransportSettings(settings); @@ -524,7 +524,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttSuccess) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); EXPECT_CALL(clientConnSetupCallback, onReplaySafe()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_FALSE(client->getConn().zeroRttWriteCipher); @@ -602,7 +602,7 @@ TEST_P(QuicClientTransportIntegrationTest, ZeroRttRetryPacketTest) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); EXPECT_CALL(clientConnSetupCallback, onReplaySafe()).WillOnce(Invoke([&] { EXPECT_TRUE(!client->getConn().retryToken.empty()); @@ -635,7 +635,7 @@ TEST_P(QuicClientTransportIntegrationTest, NewTokenReceived) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_FALSE(newToken->empty()); @@ -657,7 +657,7 @@ TEST_P(QuicClientTransportIntegrationTest, UseNewTokenThenReceiveRetryToken) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_FALSE(newToken->empty()); @@ -744,7 +744,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttRejection) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); // Rejection means that we will unset the zero rtt cipher. EXPECT_EQ(client->getConn().zeroRttWriteCipher, nullptr); @@ -791,7 +791,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttNotAttempted) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_TRUE(client->serverInitialParamsSet()); EXPECT_EQ( @@ -834,7 +834,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttInvalidAppParams) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_TRUE(client->serverInitialParamsSet()); EXPECT_EQ( @@ -868,7 +868,7 @@ TEST_P(QuicClientTransportIntegrationTest, ChangeEventBase) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); EXPECT_TRUE(client->isDetachable()); client->detachEventBase(); @@ -908,7 +908,7 @@ TEST_P(QuicClientTransportIntegrationTest, ResetClient) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); // change the address to a new server which does not have the connection. @@ -953,7 +953,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestStatelessResetToken) { auto streamId = client->createBidirectionalStream().value(); auto data = IOBuf::copyBuffer("hello"); auto expected = std::shared_ptr(IOBuf::copyBuffer("echo ")); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb); // change the address to a new server which does not have the connection. @@ -2554,7 +2554,7 @@ TEST_F(QuicClientTransportAfterStartTest, ReadStreamMultiplePackets) { auto data = IOBuf::copyBuffer("hello"); auto expected = data->clone(); - expected->prependChain(data->clone()); + expected->appendToChain(data->clone()); EXPECT_CALL(readCb, readAvailable(streamId)).WillOnce(Invoke([&](auto) { auto readData = client->read(streamId, 1000); auto copy = readData->first->clone(); @@ -5770,7 +5770,7 @@ TEST_F(QuicProcessDataTest, ProcessDataWithGarbageAtEnd) { 0 /* largestAcked */); auto packetData = packetToBufCleartext( packet, aead, getInitialHeaderCipher(), nextPacketNum); - packetData->prependChain(IOBuf::copyBuffer("garbage in")); + packetData->appendToChain(IOBuf::copyBuffer("garbage in")); deliverData(serverAddr, packetData->coalesce()); verifyTransportParameters( kDefaultConnectionFlowControlWindow, @@ -5894,7 +5894,7 @@ TEST_F(QuicProcessDataTest, ProcessPendingData) { mockClientHandshake->readBuffers[EncryptionLevel::Handshake].empty()); auto handshakeReadData = mockClientHandshake->readBuffers[EncryptionLevel::Handshake].move(); - cryptoData->prependChain(cryptoData->clone()); + cryptoData->appendToChain(cryptoData->clone()); EXPECT_TRUE(folly::IOBufEqualTo()(*cryptoData, *handshakeReadData)); } diff --git a/quic/loss/test/QuicLossFunctionsTest.cpp b/quic/loss/test/QuicLossFunctionsTest.cpp index 1ef1d1307..73530f5e3 100644 --- a/quic/loss/test/QuicLossFunctionsTest.cpp +++ b/quic/loss/test/QuicLossFunctionsTest.cpp @@ -642,7 +642,7 @@ TEST_F(QuicLossFunctionsTest, TestMarkPacketLossMerge) { EXPECT_EQ(stream1->streamLossCount, 2); auto combined = buf1->clone(); - combined->prependChain(buf2->clone()); + combined->appendToChain(buf2->clone()); auto& buffer = stream1->lossBuffer.front(); EXPECT_EQ(buffer.offset, 0); EXPECT_TRUE(areEqual(combined.get(), &buffer.data)); diff --git a/quic/samples/echo/EchoHandler.h b/quic/samples/echo/EchoHandler.h index 730e88ca8..fe7ff3fee 100644 --- a/quic/samples/echo/EchoHandler.h +++ b/quic/samples/echo/EchoHandler.h @@ -213,7 +213,7 @@ class EchoHandler : public quic::QuicSocket::ConnectionSetupCallback, return; } auto echoedData = BufHelpers::copyBuffer("echo "); - echoedData->prependChain(data.first.move()); + echoedData->appendToChain(data.first.move()); auto res = sock->writeChain(id, std::move(echoedData), true, nullptr); if (res.hasError()) { LOG(ERROR) << "write error=" << toString(res.error()); @@ -227,7 +227,7 @@ class EchoHandler : public quic::QuicSocket::ConnectionSetupCallback, CHECK_GT(datagrams.size(), 0); for (const auto& datagram : datagrams) { auto echoedData = BufHelpers::copyBuffer("echo "); - echoedData->prependChain(datagram.bufQueue().front()->cloneCoalesced()); + echoedData->appendToChain(datagram.bufQueue().front()->cloneCoalesced()); auto res = sock->writeDatagram(std::move(echoedData)); if (res.hasError()) { LOG(ERROR) << "writeDatagram error=" << toString(res.error()); diff --git a/quic/server/QuicServerPacketRouter.cpp b/quic/server/QuicServerPacketRouter.cpp index c32a9b749..69d8beb05 100644 --- a/quic/server/QuicServerPacketRouter.cpp +++ b/quic/server/QuicServerPacketRouter.cpp @@ -148,7 +148,7 @@ void TakeoverPacketHandler::forwardPacketToAnotherServer( bufWriter.writeBE(tick); writeBuffer->append(bufSize); - writeBuffer->prependChain(std::move(buf)); + writeBuffer->appendToChain(std::move(buf)); forwardPacket(std::move(writeBuffer)); } diff --git a/quic/server/handshake/StatelessResetGenerator.cpp b/quic/server/handshake/StatelessResetGenerator.cpp index 3e1856005..23268bf75 100644 --- a/quic/server/handshake/StatelessResetGenerator.cpp +++ b/quic/server/handshake/StatelessResetGenerator.cpp @@ -28,7 +28,7 @@ StatelessResetToken StatelessResetGenerator::generateToken( const ConnectionId& connId) const { StatelessResetToken token; auto info = toData(connId); - info.prependChain( + info.appendToChain( BufHelpers::wrapBuffer(addressStr_.data(), addressStr_.size())); auto out = hkdf_.expand(folly::range(extractedSecret_), info, token.size()); out->coalesce(); diff --git a/quic/server/handshake/test/ServerHandshakeTest.cpp b/quic/server/handshake/test/ServerHandshakeTest.cpp index ecc590c01..625e44e3f 100644 --- a/quic/server/handshake/test/ServerHandshakeTest.cpp +++ b/quic/server/handshake/test/ServerHandshakeTest.cpp @@ -287,18 +287,18 @@ class ServerHandshakeTest : public Test { switch (clientState.readRecordLayer()->getEncryptionLevel()) { case fizz::EncryptionLevel::Plaintext: if (!cryptoState->initialStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->initialStream.writeBuffer.move()); + buf->appendToChain(cryptoState->initialStream.writeBuffer.move()); } break; case fizz::EncryptionLevel::Handshake: case fizz::EncryptionLevel::EarlyData: if (!cryptoState->handshakeStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->handshakeStream.writeBuffer.move()); + buf->appendToChain(cryptoState->handshakeStream.writeBuffer.move()); } break; case fizz::EncryptionLevel::AppTraffic: if (!cryptoState->oneRttStream.writeBuffer.empty()) { - buf->prependChain(cryptoState->oneRttStream.writeBuffer.move()); + buf->appendToChain(cryptoState->oneRttStream.writeBuffer.move()); } } return buf; diff --git a/quic/server/test/QuicServerTransportTest.cpp b/quic/server/test/QuicServerTransportTest.cpp index 8c4165b71..2868857c4 100644 --- a/quic/server/test/QuicServerTransportTest.cpp +++ b/quic/server/test/QuicServerTransportTest.cpp @@ -4668,7 +4668,7 @@ TEST_F(QuicUnencryptedServerTransportTest, TestGarbageData) { 0 /* largestAcked */); auto packetData = packetToBufCleartext(packet, *aead, *headerCipher, nextPacket); - packetData->prependChain(IOBuf::copyBuffer("garbage in")); + packetData->appendToChain(IOBuf::copyBuffer("garbage in")); deliverData(std::move(packetData)); EXPECT_NE(server->getConn().readCodec, nullptr); EXPECT_NE(server->getConn().initialWriteCipher, nullptr); diff --git a/quic/server/test/QuicServerTransportTestUtil.h b/quic/server/test/QuicServerTransportTestUtil.h index 2bb1e41dd..959d0ee72 100644 --- a/quic/server/test/QuicServerTransportTestUtil.h +++ b/quic/server/test/QuicServerTransportTestUtil.h @@ -590,7 +590,7 @@ class QuicServerTransportTestBase : public virtual testing::Test { if (frame.type() != QuicFrame::Type::ReadCryptoFrame) { continue; } - cryptoBuf->prependChain(frame.asReadCryptoFrame()->data->clone()); + cryptoBuf->appendToChain(frame.asReadCryptoFrame()->data->clone()); } } return cryptoBuf; diff --git a/quic/state/QuicStreamFunctions.cpp b/quic/state/QuicStreamFunctions.cpp index 420e0665a..8f2c34f8f 100644 --- a/quic/state/QuicStreamFunctions.cpp +++ b/quic/state/QuicStreamFunctions.cpp @@ -15,7 +15,7 @@ namespace { void prependToBuf(quic::BufPtr& buf, quic::BufPtr toAppend) { if (buf) { - buf->prependChain(std::move(toAppend)); + buf->appendToChain(std::move(toAppend)); } else { buf = std::move(toAppend); } diff --git a/quic/state/test/QuicStreamFunctionsTest.cpp b/quic/state/test/QuicStreamFunctionsTest.cpp index e1d553a7c..b769e0126 100644 --- a/quic/state/test/QuicStreamFunctionsTest.cpp +++ b/quic/state/test/QuicStreamFunctionsTest.cpp @@ -138,7 +138,7 @@ TEST_P(QuicStreamFunctionsTestBase, TestWriteStream) { ASSERT_FALSE(writeDataToQuicStream(*stream, buf2->clone(), false).hasError()); IOBufEqualTo eq; - buf1->prependChain(std::move(buf2)); + buf1->appendToChain(std::move(buf2)); EXPECT_TRUE(eq(stream->writeBuffer.move(), buf1)); } @@ -148,10 +148,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataWrittenInOrder) { auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); auto buf2 = IOBuf::copyBuffer("Here's my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0)) .hasError()); @@ -187,10 +187,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeContiguousData) { auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); auto buf2 = IOBuf::copyBuffer("Here's my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0)) .hasError()); @@ -238,10 +238,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeNonContiguousData) { auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); auto buf2 = IOBuf::copyBuffer("'s my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0)) .hasError()); @@ -373,10 +373,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeEmptyDataEof) { TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufs) { auto stream = conn.streamManager->createNextBidirectionalStream().value(); auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); auto buf2 = IOBuf::copyBuffer("Here's my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; @@ -407,11 +407,11 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufs) { TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufsShared) { auto stream = conn.streamManager->createNextBidirectionalStream().value(); auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); buf1->coalesceWithHeadroomTailroom(0, 8000); auto buf2 = IOBuf::copyBuffer("Here's my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); // Manually share the buffers like multiple stream frames in a packet. auto buf3 = buf1->clone(); @@ -454,10 +454,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufsShared) { TEST_P(QuicStreamFunctionsTestBase, TestReadDataOutOfOrder) { auto stream = conn.streamManager->createNextBidirectionalStream().value(); auto buf1 = IOBuf::copyBuffer(" you "); - buf1->prependChain(IOBuf::copyBuffer("and this is crazy. ")); + buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. ")); auto buf2 = IOBuf::copyBuffer("Here's my number "); - buf2->prependChain(IOBuf::copyBuffer("so call me maybe")); + buf2->appendToChain(IOBuf::copyBuffer("so call me maybe")); auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; @@ -496,13 +496,13 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataOutOfOrder) { TEST_P(QuicStreamFunctionsTestBase, TestReadOverlappingData) { auto stream = conn.streamManager->createNextBidirectionalStream().value(); auto buf1 = IOBuf::copyBuffer("I just met you "); - buf1->prependChain(IOBuf::copyBuffer("and this")); + buf1->appendToChain(IOBuf::copyBuffer("and this")); auto buf2 = IOBuf::copyBuffer("met you and this is crazy. "); - buf2->prependChain(IOBuf::copyBuffer("Here's my number")); + buf2->appendToChain(IOBuf::copyBuffer("Here's my number")); auto buf3 = IOBuf::copyBuffer("Here's my number, "); - buf3->prependChain(IOBuf::copyBuffer("so call me maybe.")); + buf3->appendToChain(IOBuf::copyBuffer("so call me maybe.")); auto streamLastMaxOffset = stream->maxOffsetObserved; auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset; @@ -737,7 +737,7 @@ TEST_P(QuicStreamFunctionsTestBase, TestInsertVariations) { auto buf6 = IOBuf::copyBuffer(" me maybe"); auto buf7 = IOBuf::copyBuffer("this is crazy. Here's my number so call"); auto buf8 = IOBuf::copyBuffer("I just met you"); - buf8->prependChain(IOBuf::copyBuffer(" and this")); + buf8->appendToChain(IOBuf::copyBuffer(" and this")); auto buf9 = IOBuf::copyBuffer("Here's my number so call me maybe"); auto buf10 = IOBuf::copyBuffer("I ");