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

folly::to<> -> static_cast

Reviewed By: sharmafb

Differential Revision: D74905585

fbshipit-source-id: 057a89e000041849364436331d327eaa95bf122c
This commit is contained in:
Konstantin Tsoy
2025-05-21 13:56:32 -07:00
committed by Facebook GitHub Bot
parent cd4042c809
commit a1747af52d
24 changed files with 102 additions and 116 deletions

View File

@ -805,9 +805,9 @@ folly::Expected<bool, QuicError> DatagramFrameScheduler::writeDatagramFrames(
if (datagramLenSize.hasError()) { if (datagramLenSize.hasError()) {
return folly::makeUnexpected(datagramLenSize.error()); return folly::makeUnexpected(datagramLenSize.error());
} }
auto datagramFrameLength = uint64_t datagramFrameLength =
frameTypeSize.value() + len + datagramLenSize.value(); frameTypeSize.value() + len + datagramLenSize.value();
if (folly::to<uint64_t>(datagramFrameLength) <= spaceLeft) { if (datagramFrameLength <= spaceLeft) {
auto datagramFrame = DatagramFrame(len, payload.move()); auto datagramFrame = DatagramFrame(len, payload.move());
auto res = writeFrame(datagramFrame, builder); auto res = writeFrame(datagramFrame, builder);
if (res.hasError()) { if (res.hasError()) {
@ -914,8 +914,7 @@ CryptoStreamScheduler::CryptoStreamScheduler(
folly::Expected<bool, QuicError> CryptoStreamScheduler::writeCryptoData( folly::Expected<bool, QuicError> CryptoStreamScheduler::writeCryptoData(
PacketBuilderInterface& builder) { PacketBuilderInterface& builder) {
bool cryptoDataWritten = false; bool cryptoDataWritten = false;
uint64_t writableData = uint64_t writableData = cryptoStream_.pendingWrites.chainLength();
folly::to<uint64_t>(cryptoStream_.pendingWrites.chainLength());
// We use the crypto scheduler to reschedule the retransmissions of the // We use the crypto scheduler to reschedule the retransmissions of the
// crypto streams so that we know that retransmissions of the crypto data // crypto streams so that we know that retransmissions of the crypto data
// will always take precedence over the crypto data. // will always take precedence over the crypto data.

View File

@ -410,7 +410,7 @@ void QuicStreamAsyncTransport::send(uint64_t maxToSend) {
// overkill until there are delivery cbs // overkill until there are delivery cbs
folly::DelayedDestruction::DestructorGuard dg(this); folly::DelayedDestruction::DestructorGuard dg(this);
uint64_t toSend = uint64_t toSend =
std::min(maxToSend, folly::to<uint64_t>(writeBuf_.chainLength())); std::min(maxToSend, static_cast<uint64_t>(writeBuf_.chainLength()));
uint64_t sentOffset = streamWriteOffset_ + toSend; uint64_t sentOffset = streamWriteOffset_ + toSend;
bool writeEOF = bool writeEOF =

View File

@ -487,7 +487,7 @@ void handleNewStreamDataWritten(
// or loss buffer, but that's an expensive search. // or loss buffer, but that's an expensive search.
stream.currentWriteOffset += frameLen; stream.currentWriteOffset += frameLen;
ChainedByteRangeHead bufWritten( ChainedByteRangeHead bufWritten(
stream.pendingWrites.splitAtMost(folly::to<size_t>(frameLen))); stream.pendingWrites.splitAtMost(static_cast<size_t>(frameLen)));
DCHECK_EQ(bufWritten.chainLength(), frameLen); DCHECK_EQ(bufWritten.chainLength(), frameLen);
// TODO: If we want to be able to write FIN out of order for DSR-ed streams, // TODO: If we want to be able to write FIN out of order for DSR-ed streams,
// this needs to be fixed: // this needs to be fixed:
@ -1737,8 +1737,8 @@ folly::Expected<WriteQuicDataResult, QuicError> writeConnectionDataToSocket(
writeLoopTimeLimit(writeLoopBeginTime, connection))) { writeLoopTimeLimit(writeLoopBeginTime, connection))) {
auto packetNum = getNextPacketNum(connection, pnSpace); auto packetNum = getNextPacketNum(connection, pnSpace);
auto header = builder(srcConnId, dstConnId, packetNum, version, token); auto header = builder(srcConnId, dstConnId, packetNum, version, token);
uint32_t writableBytes = folly::to<uint32_t>(std::min<uint64_t>( uint32_t writableBytes = std::min<uint64_t>(
connection.udpSendPacketLen, writableBytesFunc(connection))); connection.udpSendPacketLen, writableBytesFunc(connection));
uint64_t cipherOverhead = aead.getCipherOverhead(); uint64_t cipherOverhead = aead.getCipherOverhead();
if (writableBytes < cipherOverhead) { if (writableBytes < cipherOverhead) {
writableBytes = 0; writableBytes = 0;
@ -1803,8 +1803,8 @@ folly::Expected<WriteQuicDataResult, QuicError> writeConnectionDataToSocket(
std::move(result->clonedPacketIdentifier), std::move(result->clonedPacketIdentifier),
std::move(result->packet->packet), std::move(result->packet->packet),
sentTime, sentTime,
folly::to<uint32_t>(ret->encodedSize), static_cast<uint32_t>(ret->encodedSize),
folly::to<uint32_t>(ret->encodedBodySize), static_cast<uint32_t>(ret->encodedBodySize),
false /* isDSRPacket */); false /* isDSRPacket */);
if (updateConnResult.hasError()) { if (updateConnResult.hasError()) {
return folly::makeUnexpected(updateConnResult.error()); return folly::makeUnexpected(updateConnResult.error());

View File

@ -103,6 +103,8 @@ mvfst_cpp_library(
"handshake/ClientTransportParametersExtension.h", "handshake/ClientTransportParametersExtension.h",
], ],
exported_deps = [ exported_deps = [
"//folly:expected",
"//quic:exception",
"//quic/handshake:transport_parameters", "//quic/handshake:transport_parameters",
], ],
) )
@ -126,7 +128,6 @@ mvfst_cpp_library(
"QuicClientAsyncTransport.h", "QuicClientAsyncTransport.h",
], ],
deps = [ deps = [
"//folly:conv",
"//folly/experimental/symbolizer:symbolizer", "//folly/experimental/symbolizer:symbolizer",
], ],
exported_deps = [ exported_deps = [

View File

@ -7,7 +7,6 @@
#include <quic/client/QuicClientAsyncTransport.h> #include <quic/client/QuicClientAsyncTransport.h>
#include <folly/Conv.h>
#include <folly/experimental/symbolizer/Symbolizer.h> #include <folly/experimental/symbolizer/Symbolizer.h>
namespace quic { namespace quic {

View File

@ -22,7 +22,6 @@ mvfst_cpp_library(
], ],
exported_deps = [ exported_deps = [
":packet_number", ":packet_number",
"//folly:conv",
"//folly:expected", "//folly:expected",
"//folly:network_address", "//folly:network_address",
"//folly:string", "//folly:string",
@ -53,7 +52,6 @@ mvfst_cpp_library(
"PacketNumber.h", "PacketNumber.h",
], ],
deps = [ deps = [
"//folly:conv",
"//folly/lang:bits", "//folly/lang:bits",
"//quic:constants", "//quic:constants",
"//quic:exception", "//quic:exception",

View File

@ -170,7 +170,7 @@ folly::Expected<ReadAckFrame, QuicError> decodeAckFrame(
return folly::makeUnexpected(QuicError( return folly::makeUnexpected(QuicError(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad largest acked")); quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad largest acked"));
} }
auto largestAcked = folly::to<PacketNum>(largestAckedInt->first); PacketNum largestAcked = largestAckedInt->first;
auto ackDelay = decodeQuicInteger(cursor); auto ackDelay = decodeQuicInteger(cursor);
if (!ackDelay) { if (!ackDelay) {
return folly::makeUnexpected(QuicError( return folly::makeUnexpected(QuicError(
@ -456,7 +456,7 @@ folly::Expected<RstStreamFrame, QuicError> decodeRstStreamFrame(
} }
} }
return RstStreamFrame( return RstStreamFrame(
folly::to<StreamId>(streamId->first), streamId->first,
errorCode, errorCode,
finalSize->first, finalSize->first,
reliableSize ? Optional<uint64_t>(reliableSize->first) : std::nullopt); reliableSize ? Optional<uint64_t>(reliableSize->first) : std::nullopt);
@ -478,7 +478,7 @@ folly::Expected<StopSendingFrame, QuicError> decodeStopSendingFrame(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, quic::TransportErrorCode::FRAME_ENCODING_ERROR,
"Cannot decode error code")); "Cannot decode error code"));
} }
return StopSendingFrame(folly::to<StreamId>(streamId->first), errorCode); return StopSendingFrame(streamId->first, errorCode);
} }
folly::Expected<ReadCryptoFrame, QuicError> decodeCryptoFrame(Cursor& cursor) { folly::Expected<ReadCryptoFrame, QuicError> decodeCryptoFrame(Cursor& cursor) {
@ -609,11 +609,7 @@ folly::Expected<ReadStreamFrame, QuicError> decodeStreamFrame(
} }
} }
return ReadStreamFrame( return ReadStreamFrame(
folly::to<StreamId>(streamId->first), streamId->first, offset, std::move(data), fin, groupId);
offset,
std::move(data),
fin,
groupId);
} }
folly::Expected<MaxDataFrame, QuicError> decodeMaxDataFrame(Cursor& cursor) { folly::Expected<MaxDataFrame, QuicError> decodeMaxDataFrame(Cursor& cursor) {
@ -637,8 +633,7 @@ folly::Expected<MaxStreamDataFrame, QuicError> decodeMaxStreamDataFrame(
return folly::makeUnexpected(QuicError( return folly::makeUnexpected(QuicError(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Invalid offset")); quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Invalid offset"));
} }
return MaxStreamDataFrame( return MaxStreamDataFrame(streamId->first, offset->first);
folly::to<StreamId>(streamId->first), offset->first);
} }
folly::Expected<MaxStreamsFrame, QuicError> decodeBiDiMaxStreamsFrame( folly::Expected<MaxStreamsFrame, QuicError> decodeBiDiMaxStreamsFrame(
@ -685,8 +680,7 @@ folly::Expected<StreamDataBlockedFrame, QuicError> decodeStreamDataBlockedFrame(
return folly::makeUnexpected(QuicError( return folly::makeUnexpected(QuicError(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad offset")); quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad offset"));
} }
return StreamDataBlockedFrame( return StreamDataBlockedFrame(streamId->first, dataLimit->first);
folly::to<StreamId>(streamId->first), dataLimit->first);
} }
folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame( folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame(
@ -697,8 +691,7 @@ folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, quic::TransportErrorCode::FRAME_ENCODING_ERROR,
"Bad Bi-Directional streamId")); "Bad Bi-Directional streamId"));
} }
return StreamsBlockedFrame( return StreamsBlockedFrame(streamId->first, true /* isBidirectional */);
folly::to<StreamId>(streamId->first), true /* isBidirectional */);
} }
folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame( folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame(
@ -709,8 +702,7 @@ folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame(
quic::TransportErrorCode::FRAME_ENCODING_ERROR, quic::TransportErrorCode::FRAME_ENCODING_ERROR,
"Bad Uni-direcitonal streamId")); "Bad Uni-direcitonal streamId"));
} }
return StreamsBlockedFrame( return StreamsBlockedFrame(streamId->first, false /* isBidirectional */);
folly::to<StreamId>(streamId->first), false /* isBidirectional */);
} }
folly::Expected<NewConnectionIdFrame, QuicError> decodeNewConnectionIdFrame( folly::Expected<NewConnectionIdFrame, QuicError> decodeNewConnectionIdFrame(

View File

@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#include <folly/Conv.h>
#include <folly/lang/Bits.h> #include <folly/lang/Bits.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <quic/QuicConstants.h> #include <quic/QuicConstants.h>

View File

@ -7,8 +7,6 @@
#include <quic/codec/QuicInteger.h> #include <quic/codec/QuicInteger.h>
#include <folly/Conv.h>
namespace quic { namespace quic {
folly::Expected<size_t, QuicError> getQuicIntegerSize(uint64_t value) { folly::Expected<size_t, QuicError> getQuicIntegerSize(uint64_t value) {

View File

@ -68,7 +68,7 @@ encodeLongHeaderHelper(
spaceCounter -= longHeaderSize; spaceCounter -= longHeaderSize;
} }
bufop.template writeBE<uint32_t>( bufop.template writeBE<uint32_t>(
folly::to<uint32_t>(longHeader.getVersion())); static_cast<uint32_t>(longHeader.getVersion()));
bufop.template writeBE<uint8_t>(longHeader.getDestinationConnId().size()); bufop.template writeBE<uint8_t>(longHeader.getDestinationConnId().size());
bufop.push( bufop.push(
longHeader.getDestinationConnId().data(), longHeader.getDestinationConnId().data(),
@ -147,7 +147,7 @@ uint32_t RegularQuicPacketBuilder::getHeaderBytes() const {
bool isLongHeader = packet_.header.getHeaderForm() == HeaderForm::Long; bool isLongHeader = packet_.header.getHeaderForm() == HeaderForm::Long;
CHECK(packetNumberEncoding_) CHECK(packetNumberEncoding_)
<< "packetNumberEncoding_ should be valid after ctor"; << "packetNumberEncoding_ should be valid after ctor";
return folly::to<uint32_t>(header_.computeChainDataLength()) + return static_cast<uint32_t>(header_.computeChainDataLength()) +
(isLongHeader ? packetNumberEncoding_->length + kMaxPacketLenSize : 0); (isLongHeader ? packetNumberEncoding_->length + kMaxPacketLenSize : 0);
} }
@ -808,7 +808,7 @@ bool InplaceQuicPacketBuilder::canBuildPacket() const noexcept {
uint32_t InplaceQuicPacketBuilder::getHeaderBytes() const { uint32_t InplaceQuicPacketBuilder::getHeaderBytes() const {
CHECK(packetNumberEncoding_) CHECK(packetNumberEncoding_)
<< "packetNumberEncoding_ should be valid after ctor"; << "packetNumberEncoding_ should be valid after ctor";
return folly::to<uint32_t>(bodyStart_ - headerStart_); return static_cast<uint32_t>(bodyStart_ - headerStart_);
} }
bool RegularQuicPacketBuilder::hasFramesPending() const { bool RegularQuicPacketBuilder::hasFramesPending() const {

View File

@ -21,7 +21,7 @@ namespace {
* Return: true if there is enough space, false otherwise * Return: true if there is enough space, false otherwise
*/ */
bool packetSpaceCheck(uint64_t limit, size_t require) { bool packetSpaceCheck(uint64_t limit, size_t require) {
return (folly::to<uint64_t>(require) <= limit); return (static_cast<uint64_t>(require) <= limit);
} }
} // namespace } // namespace

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include <folly/Conv.h>
#include <folly/IPAddress.h> #include <folly/IPAddress.h>
#include <folly/io/Cursor.h> #include <folly/io/Cursor.h>
#include <quic/QuicConstants.h> #include <quic/QuicConstants.h>

View File

@ -38,11 +38,11 @@ Optional<TransportKnobParams> parseTransportKnobs(
opts.parse_numbers_as_strings = true; opts.parse_numbers_as_strings = true;
folly::dynamic params = folly::parseJson(serializedParams, opts); folly::dynamic params = folly::parseJson(serializedParams, opts);
for (const auto& id : params.keys()) { for (const auto& id : params.keys()) {
auto paramId = folly::to<uint64_t>(id.asInt()); auto paramId = static_cast<uint64_t>(id.asInt());
auto val = params[id]; auto val = params[id];
switch (val.type()) { switch (val.type()) {
case folly::dynamic::Type::BOOL: case folly::dynamic::Type::BOOL:
knobParams.push_back({paramId, folly::to<uint64_t>(val.asInt())}); knobParams.push_back({paramId, static_cast<uint64_t>(val.asInt())});
continue; continue;
case folly::dynamic::Type::STRING: { case folly::dynamic::Type::STRING: {
/* /*
@ -79,7 +79,7 @@ Optional<TransportKnobParams> parseTransportKnobs(
congestionControlStrToType(val.asString()); congestionControlStrToType(val.asString());
if (cctype) { if (cctype) {
knobParams.push_back( knobParams.push_back(
{paramId, folly::to<uint64_t>(cctype.value())}); {paramId, static_cast<uint64_t>(cctype.value())});
} else { } else {
LOG(ERROR) << "unknown cc type " << val; LOG(ERROR) << "unknown cc type " << val;
return std::nullopt; return std::nullopt;
@ -122,7 +122,7 @@ Optional<TransportKnobParams> parseTransportKnobs(
// transport knobs must be a single int, so we pack numerator and // transport knobs must be a single int, so we pack numerator and
// denominator into a single int here and unpack in the handler // denominator into a single int here and unpack in the handler
factor = numerator * kKnobFractionMax + denominator; factor = numerator * kKnobFractionMax + denominator;
knobParams.push_back({paramId, folly::to<uint64_t>(factor)}); knobParams.push_back({paramId, factor});
} else if (paramId == TransportKnobParamId::NO_OP) { } else if (paramId == TransportKnobParamId::NO_OP) {
// No further processing needed. Ignore this knob parameter. // No further processing needed. Ignore this knob parameter.
VLOG(4) << "Skipping over noop transport knob"; VLOG(4) << "Skipping over noop transport knob";

View File

@ -330,7 +330,7 @@ RegularQuicPacketBuilder::Packet createStreamPacket(
writeStreamFrameData( writeStreamFrameData(
*builder, *builder,
std::move(dataBuf), std::move(dataBuf),
std::min(folly::to<size_t>(dataLen), data.computeChainDataLength())); std::min(static_cast<size_t>(dataLen), data.computeChainDataLength()));
return std::move(*builder).buildPacket(); return std::move(*builder).buildPacket();
} }

View File

@ -11,7 +11,8 @@ mvfst_cpp_library(
"Bandwidth.h", "Bandwidth.h",
], ],
deps = [ deps = [
"//folly:conv", "fbsource//third-party/fmt:fmt",
"//folly/lang:assume",
], ],
) )

View File

@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#include <fmt/format.h>
#include <folly/lang/Assume.h>
#include <quic/congestion_control/Bandwidth.h> #include <quic/congestion_control/Bandwidth.h>
#include <folly/Conv.h>
namespace quic { namespace quic {
std::string Bandwidth::unitName() const noexcept { std::string Bandwidth::unitName() const noexcept {

View File

@ -289,12 +289,13 @@ uint64_t Cubic::calculateCubicCwnd(int64_t delta) noexcept {
// packet size. Linux also has a limit the cwnd increase to 1 MSS per 2 ACKs. // packet size. Linux also has a limit the cwnd increase to 1 MSS per 2 ACKs.
if (delta > 0 && if (delta > 0 &&
(std::numeric_limits<uint64_t>::max() - *steadyState_.lastMaxCwndBytes < (std::numeric_limits<uint64_t>::max() - *steadyState_.lastMaxCwndBytes <
folly::to<uint64_t>(delta))) { static_cast<uint64_t>(delta))) {
LOG(WARNING) << "Quic Cubic: overflow cwnd cut at uint64_t max"; LOG(WARNING) << "Quic Cubic: overflow cwnd cut at uint64_t max";
return conn_.transportSettings.maxCwndInMss * conn_.udpSendPacketLen; return conn_.transportSettings.maxCwndInMss * conn_.udpSendPacketLen;
} else if ( } else if (
delta < 0 && delta < 0 &&
(folly::to<uint64_t>(std::abs(delta)) > *steadyState_.lastMaxCwndBytes)) { (static_cast<uint64_t>(std::abs(delta)) >
*steadyState_.lastMaxCwndBytes)) {
LOG(WARNING) << "Quic Cubic: underflow cwnd cut at minCwndBytes_ " << conn_; LOG(WARNING) << "Quic Cubic: underflow cwnd cut at minCwndBytes_ " << conn_;
return conn_.transportSettings.minCwndInMss * conn_.udpSendPacketLen; return conn_.transportSettings.minCwndInMss * conn_.udpSendPacketLen;
} else { } else {

View File

@ -50,23 +50,24 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
} }
virtual void connect() { virtual void connect() {
CHECK(!handshake CHECK(
->connect( !handshake
hostname, ->connect(
std::make_shared<ClientTransportParametersExtension>( hostname,
QuicVersion::MVFST, std::make_shared<ClientTransportParametersExtension>(
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow), QuicVersion::MVFST,
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional), static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
kDefaultIdleTimeout, static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
kDefaultAckDelayExponent, kDefaultIdleTimeout,
kDefaultUDPSendPacketLen, kDefaultAckDelayExponent,
kDefaultActiveConnectionIdLimit, kDefaultUDPSendPacketLen,
ConnectionId::createZeroLength())) kDefaultActiveConnectionIdLimit,
.hasError()); ConnectionId::createZeroLength()))
.hasError());
} }
void SetUp() override { void SetUp() override {
@ -97,10 +98,10 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
auto serverTransportParameters = auto serverTransportParameters =
std::make_shared<ServerTransportParametersExtension>( std::make_shared<ServerTransportParametersExtension>(
getVersion(), getVersion(),
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow), static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
std::numeric_limits<uint32_t>::max(), std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint32_t>::max(), std::numeric_limits<uint32_t>::max(),
/*disableMigration=*/true, /*disableMigration=*/true,
@ -436,23 +437,24 @@ class ClientHandshakeCallbackTest : public ClientHandshakeTest {
} }
void connect() override { void connect() override {
CHECK(!handshake CHECK(
->connect( !handshake
hostname, ->connect(
std::make_shared<ClientTransportParametersExtension>( hostname,
QuicVersion::MVFST, std::make_shared<ClientTransportParametersExtension>(
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow), QuicVersion::MVFST,
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional), static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
kDefaultIdleTimeout, static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
kDefaultAckDelayExponent, kDefaultIdleTimeout,
kDefaultUDPSendPacketLen, kDefaultAckDelayExponent,
kDefaultActiveConnectionIdLimit, kDefaultUDPSendPacketLen,
ConnectionId::createZeroLength())) kDefaultActiveConnectionIdLimit,
.hasError()); ConnectionId::createZeroLength()))
.hasError());
} }
protected: protected:
@ -548,23 +550,24 @@ class ClientHandshakeZeroRttTest : public ClientHandshakeTest {
} }
void connect() override { void connect() override {
CHECK(!handshake CHECK(
->connect( !handshake
hostname, ->connect(
std::make_shared<ClientTransportParametersExtension>( hostname,
QuicVersion::MVFST, std::make_shared<ClientTransportParametersExtension>(
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow), QuicVersion::MVFST,
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultStreamFlowControlWindow), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional), static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional), static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
kDefaultIdleTimeout, static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
kDefaultAckDelayExponent, kDefaultIdleTimeout,
kDefaultUDPSendPacketLen, kDefaultAckDelayExponent,
kDefaultActiveConnectionIdLimit, kDefaultUDPSendPacketLen,
ConnectionId::createZeroLength())) kDefaultActiveConnectionIdLimit,
.hasError()); ConnectionId::createZeroLength()))
.hasError());
} }
virtual void setupZeroRttServer() { virtual void setupZeroRttServer() {

View File

@ -61,7 +61,6 @@ mvfst_cpp_library(
"fbsource//third-party/fmt:fmt", "fbsource//third-party/fmt:fmt",
":accept_observer", ":accept_observer",
"//common/network:mvfst_hooks", # @manual "//common/network:mvfst_hooks", # @manual
"//folly:conv",
"//folly/chrono:conv", "//folly/chrono:conv",
"//folly/io:iobuf", "//folly/io:iobuf",
"//folly/io/async:event_base_manager", "//folly/io/async:event_base_manager",

View File

@ -22,7 +22,6 @@
#define SOF_TIMESTAMPING_SOFTWARE 0 #define SOF_TIMESTAMPING_SOFTWARE 0
#endif #endif
#include <folly/Conv.h>
#include <quic/common/SocketUtil.h> #include <quic/common/SocketUtil.h>
#include <quic/congestion_control/Bbr.h> #include <quic/congestion_control/Bbr.h>
#include <quic/congestion_control/Copa.h> #include <quic/congestion_control/Copa.h>
@ -332,8 +331,11 @@ void QuicServerWorker::onDataAvailable(
auto originalPacketReceiveTime = packetReceiveTime; auto originalPacketReceiveTime = packetReceiveTime;
if (params.ts) { if (params.ts) {
// This is the software system time from the datagram. // This is the software system time from the datagram.
const auto& tsTimespec = params.ts.value()[0];
auto packetRxEpochUs = auto packetRxEpochUs =
folly::to<std::chrono::microseconds>(params.ts.value()[0]); std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::seconds(tsTimespec.tv_sec) +
std::chrono::nanoseconds(tsTimespec.tv_nsec));
if (packetRxEpochUs != 0us) { if (packetRxEpochUs != 0us) {
auto now = std::chrono::system_clock::now(); auto now = std::chrono::system_clock::now();
auto nowEpochUs = std::chrono::duration_cast<std::chrono::microseconds>( auto nowEpochUs = std::chrono::duration_cast<std::chrono::microseconds>(

View File

@ -14,9 +14,6 @@ mvfst_cpp_library(
"QuicAsyncTransportServer.h", "QuicAsyncTransportServer.h",
"QuicServerAsyncTransport.h", "QuicServerAsyncTransport.h",
], ],
deps = [
"//folly:conv",
],
exported_deps = [ exported_deps = [
"//folly/io/async:async_transport", "//folly/io/async:async_transport",
"//folly/io/async:scoped_event_base_thread", "//folly/io/async:scoped_event_base_thread",

View File

@ -7,8 +7,6 @@
#include <quic/server/async_tran/QuicServerAsyncTransport.h> #include <quic/server/async_tran/QuicServerAsyncTransport.h>
#include <folly/Conv.h>
namespace quic { namespace quic {
void QuicServerAsyncTransport::setServerSocket( void QuicServerAsyncTransport::setServerSocket(

View File

@ -3894,7 +3894,7 @@ TEST_F(
writeStreamFrameData( writeStreamFrameData(
builder, builder,
data->clone(), data->clone(),
std::min(folly::to<size_t>(dataLen), data->computeChainDataLength())); std::min(static_cast<size_t>(dataLen), data->computeChainDataLength()));
ASSERT_FALSE(builder.encodePacketHeader().hasError()); ASSERT_FALSE(builder.encodePacketHeader().hasError());
builder.accountForCipherOverhead(0); builder.accountForCipherOverhead(0);
@ -3938,7 +3938,7 @@ TEST_F(
writeStreamFrameData( writeStreamFrameData(
builder, builder,
data->clone(), data->clone(),
std::min(folly::to<size_t>(dataLen), data->computeChainDataLength())); std::min(static_cast<size_t>(dataLen), data->computeChainDataLength()));
ASSERT_FALSE(builder.encodePacketHeader().hasError()); ASSERT_FALSE(builder.encodePacketHeader().hasError());
builder.accountForCipherOverhead(0); builder.accountForCipherOverhead(0);
@ -3983,7 +3983,7 @@ TEST_F(
writeStreamFrameData( writeStreamFrameData(
builder, builder,
data->clone(), data->clone(),
std::min(folly::to<size_t>(dataLen), data->computeChainDataLength())); std::min(static_cast<size_t>(dataLen), data->computeChainDataLength()));
ASSERT_FALSE(builder.encodePacketHeader().hasError()); ASSERT_FALSE(builder.encodePacketHeader().hasError());
builder.accountForCipherOverhead(0); builder.accountForCipherOverhead(0);

View File

@ -802,7 +802,7 @@ TEST_P(QuicStreamManagerTest, TestReliableResetBasic) {
// A frame of length 4 has been written to the wire // A frame of length 4 has been written to the wire
quicStreamState->currentWriteOffset += 4; quicStreamState->currentWriteOffset += 4;
ChainedByteRangeHead bufWritten1( ChainedByteRangeHead bufWritten1(
quicStreamState->pendingWrites.splitAtMost(folly::to<size_t>(4))); quicStreamState->pendingWrites.splitAtMost(4));
quicStreamState->retransmissionBuffer.emplace( quicStreamState->retransmissionBuffer.emplace(
std::piecewise_construct, std::piecewise_construct,
std::forward_as_tuple(5), std::forward_as_tuple(5),
@ -814,7 +814,7 @@ TEST_P(QuicStreamManagerTest, TestReliableResetBasic) {
// A frame of length 2 has been written to the wire // A frame of length 2 has been written to the wire
quicStreamState->currentWriteOffset += 2; quicStreamState->currentWriteOffset += 2;
ChainedByteRangeHead bufWritten2( ChainedByteRangeHead bufWritten2(
quicStreamState->pendingWrites.splitAtMost(folly::to<size_t>(2))); quicStreamState->pendingWrites.splitAtMost(2));
quicStreamState->retransmissionBuffer.emplace( quicStreamState->retransmissionBuffer.emplace(
std::piecewise_construct, std::piecewise_construct,
std::forward_as_tuple(9), std::forward_as_tuple(9),