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:
committed by
Facebook GitHub Bot
parent
cd4042c809
commit
a1747af52d
@ -805,9 +805,9 @@ folly::Expected<bool, QuicError> DatagramFrameScheduler::writeDatagramFrames(
|
||||
if (datagramLenSize.hasError()) {
|
||||
return folly::makeUnexpected(datagramLenSize.error());
|
||||
}
|
||||
auto datagramFrameLength =
|
||||
uint64_t datagramFrameLength =
|
||||
frameTypeSize.value() + len + datagramLenSize.value();
|
||||
if (folly::to<uint64_t>(datagramFrameLength) <= spaceLeft) {
|
||||
if (datagramFrameLength <= spaceLeft) {
|
||||
auto datagramFrame = DatagramFrame(len, payload.move());
|
||||
auto res = writeFrame(datagramFrame, builder);
|
||||
if (res.hasError()) {
|
||||
@ -914,8 +914,7 @@ CryptoStreamScheduler::CryptoStreamScheduler(
|
||||
folly::Expected<bool, QuicError> CryptoStreamScheduler::writeCryptoData(
|
||||
PacketBuilderInterface& builder) {
|
||||
bool cryptoDataWritten = false;
|
||||
uint64_t writableData =
|
||||
folly::to<uint64_t>(cryptoStream_.pendingWrites.chainLength());
|
||||
uint64_t writableData = cryptoStream_.pendingWrites.chainLength();
|
||||
// We use the crypto scheduler to reschedule the retransmissions of the
|
||||
// crypto streams so that we know that retransmissions of the crypto data
|
||||
// will always take precedence over the crypto data.
|
||||
|
@ -410,7 +410,7 @@ void QuicStreamAsyncTransport::send(uint64_t maxToSend) {
|
||||
// overkill until there are delivery cbs
|
||||
folly::DelayedDestruction::DestructorGuard dg(this);
|
||||
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;
|
||||
bool writeEOF =
|
||||
|
@ -487,7 +487,7 @@ void handleNewStreamDataWritten(
|
||||
// or loss buffer, but that's an expensive search.
|
||||
stream.currentWriteOffset += frameLen;
|
||||
ChainedByteRangeHead bufWritten(
|
||||
stream.pendingWrites.splitAtMost(folly::to<size_t>(frameLen)));
|
||||
stream.pendingWrites.splitAtMost(static_cast<size_t>(frameLen)));
|
||||
DCHECK_EQ(bufWritten.chainLength(), frameLen);
|
||||
// TODO: If we want to be able to write FIN out of order for DSR-ed streams,
|
||||
// this needs to be fixed:
|
||||
@ -1737,8 +1737,8 @@ folly::Expected<WriteQuicDataResult, QuicError> writeConnectionDataToSocket(
|
||||
writeLoopTimeLimit(writeLoopBeginTime, connection))) {
|
||||
auto packetNum = getNextPacketNum(connection, pnSpace);
|
||||
auto header = builder(srcConnId, dstConnId, packetNum, version, token);
|
||||
uint32_t writableBytes = folly::to<uint32_t>(std::min<uint64_t>(
|
||||
connection.udpSendPacketLen, writableBytesFunc(connection)));
|
||||
uint32_t writableBytes = std::min<uint64_t>(
|
||||
connection.udpSendPacketLen, writableBytesFunc(connection));
|
||||
uint64_t cipherOverhead = aead.getCipherOverhead();
|
||||
if (writableBytes < cipherOverhead) {
|
||||
writableBytes = 0;
|
||||
@ -1803,8 +1803,8 @@ folly::Expected<WriteQuicDataResult, QuicError> writeConnectionDataToSocket(
|
||||
std::move(result->clonedPacketIdentifier),
|
||||
std::move(result->packet->packet),
|
||||
sentTime,
|
||||
folly::to<uint32_t>(ret->encodedSize),
|
||||
folly::to<uint32_t>(ret->encodedBodySize),
|
||||
static_cast<uint32_t>(ret->encodedSize),
|
||||
static_cast<uint32_t>(ret->encodedBodySize),
|
||||
false /* isDSRPacket */);
|
||||
if (updateConnResult.hasError()) {
|
||||
return folly::makeUnexpected(updateConnResult.error());
|
||||
|
@ -103,6 +103,8 @@ mvfst_cpp_library(
|
||||
"handshake/ClientTransportParametersExtension.h",
|
||||
],
|
||||
exported_deps = [
|
||||
"//folly:expected",
|
||||
"//quic:exception",
|
||||
"//quic/handshake:transport_parameters",
|
||||
],
|
||||
)
|
||||
@ -126,7 +128,6 @@ mvfst_cpp_library(
|
||||
"QuicClientAsyncTransport.h",
|
||||
],
|
||||
deps = [
|
||||
"//folly:conv",
|
||||
"//folly/experimental/symbolizer:symbolizer",
|
||||
],
|
||||
exported_deps = [
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <quic/client/QuicClientAsyncTransport.h>
|
||||
|
||||
#include <folly/Conv.h>
|
||||
#include <folly/experimental/symbolizer/Symbolizer.h>
|
||||
|
||||
namespace quic {
|
||||
|
@ -22,7 +22,6 @@ mvfst_cpp_library(
|
||||
],
|
||||
exported_deps = [
|
||||
":packet_number",
|
||||
"//folly:conv",
|
||||
"//folly:expected",
|
||||
"//folly:network_address",
|
||||
"//folly:string",
|
||||
@ -53,7 +52,6 @@ mvfst_cpp_library(
|
||||
"PacketNumber.h",
|
||||
],
|
||||
deps = [
|
||||
"//folly:conv",
|
||||
"//folly/lang:bits",
|
||||
"//quic:constants",
|
||||
"//quic:exception",
|
||||
|
@ -170,7 +170,7 @@ folly::Expected<ReadAckFrame, QuicError> decodeAckFrame(
|
||||
return folly::makeUnexpected(QuicError(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad largest acked"));
|
||||
}
|
||||
auto largestAcked = folly::to<PacketNum>(largestAckedInt->first);
|
||||
PacketNum largestAcked = largestAckedInt->first;
|
||||
auto ackDelay = decodeQuicInteger(cursor);
|
||||
if (!ackDelay) {
|
||||
return folly::makeUnexpected(QuicError(
|
||||
@ -456,7 +456,7 @@ folly::Expected<RstStreamFrame, QuicError> decodeRstStreamFrame(
|
||||
}
|
||||
}
|
||||
return RstStreamFrame(
|
||||
folly::to<StreamId>(streamId->first),
|
||||
streamId->first,
|
||||
errorCode,
|
||||
finalSize->first,
|
||||
reliableSize ? Optional<uint64_t>(reliableSize->first) : std::nullopt);
|
||||
@ -478,7 +478,7 @@ folly::Expected<StopSendingFrame, QuicError> decodeStopSendingFrame(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR,
|
||||
"Cannot decode error code"));
|
||||
}
|
||||
return StopSendingFrame(folly::to<StreamId>(streamId->first), errorCode);
|
||||
return StopSendingFrame(streamId->first, errorCode);
|
||||
}
|
||||
|
||||
folly::Expected<ReadCryptoFrame, QuicError> decodeCryptoFrame(Cursor& cursor) {
|
||||
@ -609,11 +609,7 @@ folly::Expected<ReadStreamFrame, QuicError> decodeStreamFrame(
|
||||
}
|
||||
}
|
||||
return ReadStreamFrame(
|
||||
folly::to<StreamId>(streamId->first),
|
||||
offset,
|
||||
std::move(data),
|
||||
fin,
|
||||
groupId);
|
||||
streamId->first, offset, std::move(data), fin, groupId);
|
||||
}
|
||||
|
||||
folly::Expected<MaxDataFrame, QuicError> decodeMaxDataFrame(Cursor& cursor) {
|
||||
@ -637,8 +633,7 @@ folly::Expected<MaxStreamDataFrame, QuicError> decodeMaxStreamDataFrame(
|
||||
return folly::makeUnexpected(QuicError(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Invalid offset"));
|
||||
}
|
||||
return MaxStreamDataFrame(
|
||||
folly::to<StreamId>(streamId->first), offset->first);
|
||||
return MaxStreamDataFrame(streamId->first, offset->first);
|
||||
}
|
||||
|
||||
folly::Expected<MaxStreamsFrame, QuicError> decodeBiDiMaxStreamsFrame(
|
||||
@ -685,8 +680,7 @@ folly::Expected<StreamDataBlockedFrame, QuicError> decodeStreamDataBlockedFrame(
|
||||
return folly::makeUnexpected(QuicError(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR, "Bad offset"));
|
||||
}
|
||||
return StreamDataBlockedFrame(
|
||||
folly::to<StreamId>(streamId->first), dataLimit->first);
|
||||
return StreamDataBlockedFrame(streamId->first, dataLimit->first);
|
||||
}
|
||||
|
||||
folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame(
|
||||
@ -697,8 +691,7 @@ folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR,
|
||||
"Bad Bi-Directional streamId"));
|
||||
}
|
||||
return StreamsBlockedFrame(
|
||||
folly::to<StreamId>(streamId->first), true /* isBidirectional */);
|
||||
return StreamsBlockedFrame(streamId->first, true /* isBidirectional */);
|
||||
}
|
||||
|
||||
folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame(
|
||||
@ -709,8 +702,7 @@ folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame(
|
||||
quic::TransportErrorCode::FRAME_ENCODING_ERROR,
|
||||
"Bad Uni-direcitonal streamId"));
|
||||
}
|
||||
return StreamsBlockedFrame(
|
||||
folly::to<StreamId>(streamId->first), false /* isBidirectional */);
|
||||
return StreamsBlockedFrame(streamId->first, false /* isBidirectional */);
|
||||
}
|
||||
|
||||
folly::Expected<NewConnectionIdFrame, QuicError> decodeNewConnectionIdFrame(
|
||||
|
@ -5,7 +5,6 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <folly/Conv.h>
|
||||
#include <folly/lang/Bits.h>
|
||||
#include <glog/logging.h>
|
||||
#include <quic/QuicConstants.h>
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include <quic/codec/QuicInteger.h>
|
||||
|
||||
#include <folly/Conv.h>
|
||||
|
||||
namespace quic {
|
||||
|
||||
folly::Expected<size_t, QuicError> getQuicIntegerSize(uint64_t value) {
|
||||
|
@ -68,7 +68,7 @@ encodeLongHeaderHelper(
|
||||
spaceCounter -= longHeaderSize;
|
||||
}
|
||||
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.push(
|
||||
longHeader.getDestinationConnId().data(),
|
||||
@ -147,7 +147,7 @@ uint32_t RegularQuicPacketBuilder::getHeaderBytes() const {
|
||||
bool isLongHeader = packet_.header.getHeaderForm() == HeaderForm::Long;
|
||||
CHECK(packetNumberEncoding_)
|
||||
<< "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);
|
||||
}
|
||||
|
||||
@ -808,7 +808,7 @@ bool InplaceQuicPacketBuilder::canBuildPacket() const noexcept {
|
||||
uint32_t InplaceQuicPacketBuilder::getHeaderBytes() const {
|
||||
CHECK(packetNumberEncoding_)
|
||||
<< "packetNumberEncoding_ should be valid after ctor";
|
||||
return folly::to<uint32_t>(bodyStart_ - headerStart_);
|
||||
return static_cast<uint32_t>(bodyStart_ - headerStart_);
|
||||
}
|
||||
|
||||
bool RegularQuicPacketBuilder::hasFramesPending() const {
|
||||
|
@ -21,7 +21,7 @@ namespace {
|
||||
* Return: true if there is enough space, false otherwise
|
||||
*/
|
||||
bool packetSpaceCheck(uint64_t limit, size_t require) {
|
||||
return (folly::to<uint64_t>(require) <= limit);
|
||||
return (static_cast<uint64_t>(require) <= limit);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <folly/Conv.h>
|
||||
#include <folly/IPAddress.h>
|
||||
#include <folly/io/Cursor.h>
|
||||
#include <quic/QuicConstants.h>
|
||||
|
@ -38,11 +38,11 @@ Optional<TransportKnobParams> parseTransportKnobs(
|
||||
opts.parse_numbers_as_strings = true;
|
||||
folly::dynamic params = folly::parseJson(serializedParams, opts);
|
||||
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];
|
||||
switch (val.type()) {
|
||||
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;
|
||||
case folly::dynamic::Type::STRING: {
|
||||
/*
|
||||
@ -79,7 +79,7 @@ Optional<TransportKnobParams> parseTransportKnobs(
|
||||
congestionControlStrToType(val.asString());
|
||||
if (cctype) {
|
||||
knobParams.push_back(
|
||||
{paramId, folly::to<uint64_t>(cctype.value())});
|
||||
{paramId, static_cast<uint64_t>(cctype.value())});
|
||||
} else {
|
||||
LOG(ERROR) << "unknown cc type " << val;
|
||||
return std::nullopt;
|
||||
@ -122,7 +122,7 @@ Optional<TransportKnobParams> parseTransportKnobs(
|
||||
// transport knobs must be a single int, so we pack numerator and
|
||||
// denominator into a single int here and unpack in the handler
|
||||
factor = numerator * kKnobFractionMax + denominator;
|
||||
knobParams.push_back({paramId, folly::to<uint64_t>(factor)});
|
||||
knobParams.push_back({paramId, factor});
|
||||
} else if (paramId == TransportKnobParamId::NO_OP) {
|
||||
// No further processing needed. Ignore this knob parameter.
|
||||
VLOG(4) << "Skipping over noop transport knob";
|
||||
|
@ -330,7 +330,7 @@ RegularQuicPacketBuilder::Packet createStreamPacket(
|
||||
writeStreamFrameData(
|
||||
*builder,
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,8 @@ mvfst_cpp_library(
|
||||
"Bandwidth.h",
|
||||
],
|
||||
deps = [
|
||||
"//folly:conv",
|
||||
"fbsource//third-party/fmt:fmt",
|
||||
"//folly/lang:assume",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
* 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 <folly/Conv.h>
|
||||
|
||||
namespace quic {
|
||||
|
||||
std::string Bandwidth::unitName() const noexcept {
|
||||
|
@ -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.
|
||||
if (delta > 0 &&
|
||||
(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";
|
||||
return conn_.transportSettings.maxCwndInMss * conn_.udpSendPacketLen;
|
||||
} else if (
|
||||
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_;
|
||||
return conn_.transportSettings.minCwndInMss * conn_.udpSendPacketLen;
|
||||
} else {
|
||||
|
@ -50,17 +50,18 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
|
||||
}
|
||||
|
||||
virtual void connect() {
|
||||
CHECK(!handshake
|
||||
CHECK(
|
||||
!handshake
|
||||
->connect(
|
||||
hostname,
|
||||
std::make_shared<ClientTransportParametersExtension>(
|
||||
QuicVersion::MVFST,
|
||||
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
kDefaultIdleTimeout,
|
||||
kDefaultAckDelayExponent,
|
||||
kDefaultUDPSendPacketLen,
|
||||
@ -97,10 +98,10 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
|
||||
auto serverTransportParameters =
|
||||
std::make_shared<ServerTransportParametersExtension>(
|
||||
getVersion(),
|
||||
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
std::numeric_limits<uint32_t>::max(),
|
||||
std::numeric_limits<uint32_t>::max(),
|
||||
/*disableMigration=*/true,
|
||||
@ -436,17 +437,18 @@ class ClientHandshakeCallbackTest : public ClientHandshakeTest {
|
||||
}
|
||||
|
||||
void connect() override {
|
||||
CHECK(!handshake
|
||||
CHECK(
|
||||
!handshake
|
||||
->connect(
|
||||
hostname,
|
||||
std::make_shared<ClientTransportParametersExtension>(
|
||||
QuicVersion::MVFST,
|
||||
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
kDefaultIdleTimeout,
|
||||
kDefaultAckDelayExponent,
|
||||
kDefaultUDPSendPacketLen,
|
||||
@ -548,17 +550,18 @@ class ClientHandshakeZeroRttTest : public ClientHandshakeTest {
|
||||
}
|
||||
|
||||
void connect() override {
|
||||
CHECK(!handshake
|
||||
CHECK(
|
||||
!handshake
|
||||
->connect(
|
||||
hostname,
|
||||
std::make_shared<ClientTransportParametersExtension>(
|
||||
QuicVersion::MVFST,
|
||||
folly::to<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
folly::to<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
static_cast<uint32_t>(kDefaultConnectionFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultStreamFlowControlWindow),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsBidirectional),
|
||||
static_cast<uint32_t>(kDefaultMaxStreamsUnidirectional),
|
||||
kDefaultIdleTimeout,
|
||||
kDefaultAckDelayExponent,
|
||||
kDefaultUDPSendPacketLen,
|
||||
|
@ -61,7 +61,6 @@ mvfst_cpp_library(
|
||||
"fbsource//third-party/fmt:fmt",
|
||||
":accept_observer",
|
||||
"//common/network:mvfst_hooks", # @manual
|
||||
"//folly:conv",
|
||||
"//folly/chrono:conv",
|
||||
"//folly/io:iobuf",
|
||||
"//folly/io/async:event_base_manager",
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define SOF_TIMESTAMPING_SOFTWARE 0
|
||||
#endif
|
||||
|
||||
#include <folly/Conv.h>
|
||||
#include <quic/common/SocketUtil.h>
|
||||
#include <quic/congestion_control/Bbr.h>
|
||||
#include <quic/congestion_control/Copa.h>
|
||||
@ -332,8 +331,11 @@ void QuicServerWorker::onDataAvailable(
|
||||
auto originalPacketReceiveTime = packetReceiveTime;
|
||||
if (params.ts) {
|
||||
// This is the software system time from the datagram.
|
||||
const auto& tsTimespec = params.ts.value()[0];
|
||||
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) {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto nowEpochUs = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
|
@ -14,9 +14,6 @@ mvfst_cpp_library(
|
||||
"QuicAsyncTransportServer.h",
|
||||
"QuicServerAsyncTransport.h",
|
||||
],
|
||||
deps = [
|
||||
"//folly:conv",
|
||||
],
|
||||
exported_deps = [
|
||||
"//folly/io/async:async_transport",
|
||||
"//folly/io/async:scoped_event_base_thread",
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include <quic/server/async_tran/QuicServerAsyncTransport.h>
|
||||
|
||||
#include <folly/Conv.h>
|
||||
|
||||
namespace quic {
|
||||
|
||||
void QuicServerAsyncTransport::setServerSocket(
|
||||
|
@ -3894,7 +3894,7 @@ TEST_F(
|
||||
writeStreamFrameData(
|
||||
builder,
|
||||
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());
|
||||
builder.accountForCipherOverhead(0);
|
||||
@ -3938,7 +3938,7 @@ TEST_F(
|
||||
writeStreamFrameData(
|
||||
builder,
|
||||
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());
|
||||
builder.accountForCipherOverhead(0);
|
||||
@ -3983,7 +3983,7 @@ TEST_F(
|
||||
writeStreamFrameData(
|
||||
builder,
|
||||
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());
|
||||
builder.accountForCipherOverhead(0);
|
||||
|
@ -802,7 +802,7 @@ TEST_P(QuicStreamManagerTest, TestReliableResetBasic) {
|
||||
// A frame of length 4 has been written to the wire
|
||||
quicStreamState->currentWriteOffset += 4;
|
||||
ChainedByteRangeHead bufWritten1(
|
||||
quicStreamState->pendingWrites.splitAtMost(folly::to<size_t>(4)));
|
||||
quicStreamState->pendingWrites.splitAtMost(4));
|
||||
quicStreamState->retransmissionBuffer.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(5),
|
||||
@ -814,7 +814,7 @@ TEST_P(QuicStreamManagerTest, TestReliableResetBasic) {
|
||||
// A frame of length 2 has been written to the wire
|
||||
quicStreamState->currentWriteOffset += 2;
|
||||
ChainedByteRangeHead bufWritten2(
|
||||
quicStreamState->pendingWrites.splitAtMost(folly::to<size_t>(2)));
|
||||
quicStreamState->pendingWrites.splitAtMost(2));
|
||||
quicStreamState->retransmissionBuffer.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(9),
|
||||
|
Reference in New Issue
Block a user