mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-04-18 17:24:03 +03:00
Add some [[nodiscard]] and standardize on it
Summary: Add some that were missing in the codec. Also replace all FOLLY_DISCARD with [[nodiscard]] since we support it everywhere. Reviewed By: kvtsoy Differential Revision: D72571687 fbshipit-source-id: af296858eedcb033dcae9db1c5a3a2318e4acea7
This commit is contained in:
parent
67ce39cfdd
commit
c6e39980db
@ -53,15 +53,15 @@ class MiddleStartingIterationWrapper {
|
||||
wrappedAround_ = false;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD const MapType::value_type& dereference() const {
|
||||
[[nodiscard]] const MapType::value_type& dereference() const {
|
||||
return *itr_;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD MapType::const_iterator rawIterator() const {
|
||||
[[nodiscard]] MapType::const_iterator rawIterator() const {
|
||||
return itr_;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool equal(const MiddleStartingIterator& other) const {
|
||||
[[nodiscard]] bool equal(const MiddleStartingIterator& other) const {
|
||||
return wrappedAround_ == other.wrappedAround_ && itr_ == other.itr_;
|
||||
}
|
||||
|
||||
@ -94,11 +94,11 @@ class MiddleStartingIterationWrapper {
|
||||
const MapType::const_iterator& start)
|
||||
: streams_(streams), start_(&streams_, start) {}
|
||||
|
||||
FOLLY_NODISCARD MiddleStartingIterator cbegin() const {
|
||||
[[nodiscard]] MiddleStartingIterator cbegin() const {
|
||||
return start_;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD MiddleStartingIterator cend() const {
|
||||
[[nodiscard]] MiddleStartingIterator cend() const {
|
||||
MiddleStartingIterator itr(start_);
|
||||
itr.wrappedAround_ = true;
|
||||
return itr;
|
||||
|
@ -171,7 +171,7 @@ class DatagramFrameScheduler {
|
||||
public:
|
||||
explicit DatagramFrameScheduler(QuicConnectionStateBase& conn);
|
||||
|
||||
FOLLY_NODISCARD bool hasPendingDatagramFrames() const;
|
||||
[[nodiscard]] bool hasPendingDatagramFrames() const;
|
||||
|
||||
bool writeDatagramFrames(PacketBuilderInterface& builder);
|
||||
|
||||
@ -287,15 +287,15 @@ class FrameScheduler : public QuicPacketScheduler {
|
||||
uint32_t writableBytes) override;
|
||||
|
||||
// If any scheduler, including AckScheduler, has pending data to send
|
||||
FOLLY_NODISCARD bool hasData() const override;
|
||||
[[nodiscard]] bool hasData() const override;
|
||||
|
||||
// If AckScheduler has any pending acks to write.
|
||||
FOLLY_NODISCARD bool hasPendingAcks() const;
|
||||
[[nodiscard]] bool hasPendingAcks() const;
|
||||
|
||||
// If any of the non-Ack scheduler has pending data to send
|
||||
FOLLY_NODISCARD virtual bool hasImmediateData() const;
|
||||
[[nodiscard]] virtual bool hasImmediateData() const;
|
||||
|
||||
FOLLY_NODISCARD folly::StringPiece name() const override;
|
||||
[[nodiscard]] folly::StringPiece name() const override;
|
||||
|
||||
private:
|
||||
Optional<StreamFrameScheduler> streamFrameScheduler_;
|
||||
|
@ -101,8 +101,8 @@ class QuicSocket : virtual public QuicSocketLite {
|
||||
/**
|
||||
* Get the original Quic Server Connection ID chosen by client
|
||||
*/
|
||||
FOLLY_NODISCARD virtual Optional<ConnectionId>
|
||||
getClientChosenDestConnectionId() const = 0;
|
||||
[[nodiscard]] virtual Optional<ConnectionId> getClientChosenDestConnectionId()
|
||||
const = 0;
|
||||
|
||||
virtual bool replaySafe() const = 0;
|
||||
|
||||
@ -395,7 +395,7 @@ class QuicSocket : virtual public QuicSocketLite {
|
||||
* Returns the maximum allowed Datagram payload size.
|
||||
* 0 means Datagram is not supported
|
||||
*/
|
||||
FOLLY_NODISCARD virtual uint16_t getDatagramSizeLimit() const = 0;
|
||||
[[nodiscard]] virtual uint16_t getDatagramSizeLimit() const = 0;
|
||||
|
||||
/**
|
||||
* Writes a Datagram frame. If buf is larger than the size limit returned by
|
||||
|
@ -499,13 +499,13 @@ class QuicSocketLite {
|
||||
/**
|
||||
* Get the number of pending byte events for the given stream.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual size_t getNumByteEventCallbacksForStream(
|
||||
[[nodiscard]] virtual size_t getNumByteEventCallbacksForStream(
|
||||
const StreamId streamId) const = 0;
|
||||
|
||||
/**
|
||||
* Get the number of pending byte events of specified type for given stream.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual size_t getNumByteEventCallbacksForStream(
|
||||
[[nodiscard]] virtual size_t getNumByteEventCallbacksForStream(
|
||||
const ByteEvent::Type type,
|
||||
const StreamId streamId) const = 0;
|
||||
|
||||
@ -781,7 +781,7 @@ class QuicSocketLite {
|
||||
/**
|
||||
* Can Knob Frames be exchanged with the peer on this connection?
|
||||
*/
|
||||
FOLLY_NODISCARD virtual bool isKnobSupported() const = 0;
|
||||
[[nodiscard]] virtual bool isKnobSupported() const = 0;
|
||||
|
||||
/**
|
||||
* Set stream priority.
|
||||
@ -851,7 +851,7 @@ class QuicSocketLite {
|
||||
/**
|
||||
* Get the cert presented by peer
|
||||
*/
|
||||
FOLLY_NODISCARD virtual const std::shared_ptr<
|
||||
[[nodiscard]] virtual const std::shared_ptr<
|
||||
const folly::AsyncTransportCertificate>
|
||||
getPeerCertificate() const {
|
||||
return nullptr;
|
||||
@ -860,7 +860,7 @@ class QuicSocketLite {
|
||||
/**
|
||||
* Get the cert presented by self
|
||||
*/
|
||||
FOLLY_NODISCARD virtual const std::shared_ptr<
|
||||
[[nodiscard]] virtual const std::shared_ptr<
|
||||
const folly::AsyncTransportCertificate>
|
||||
getSelfCertificate() const {
|
||||
return nullptr;
|
||||
@ -919,7 +919,7 @@ class QuicSocketLite {
|
||||
/**
|
||||
* Returns varios stats of the connection.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual QuicConnectionStats getConnectionsStats() const = 0;
|
||||
[[nodiscard]] virtual QuicConnectionStats getConnectionsStats() const = 0;
|
||||
|
||||
using Observer = SocketObserverContainer::Observer;
|
||||
using ManagedObserver = SocketObserverContainer::ManagedObserver;
|
||||
|
@ -181,7 +181,7 @@ class QuicTransportBase : public QuicSocket,
|
||||
* Returns the maximum allowed Datagram payload size.
|
||||
* 0 means Datagram is not supported
|
||||
*/
|
||||
FOLLY_NODISCARD uint16_t getDatagramSizeLimit() const override;
|
||||
[[nodiscard]] uint16_t getDatagramSizeLimit() const override;
|
||||
|
||||
/**
|
||||
* Writes a Datagram frame. If buf is larger than the size limit returned by
|
||||
|
@ -212,7 +212,7 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
||||
/**
|
||||
* Can Knob Frames be exchanged with the peer on this connection?
|
||||
*/
|
||||
FOLLY_NODISCARD bool isKnobSupported() const override;
|
||||
[[nodiscard]] bool isKnobSupported() const override;
|
||||
|
||||
folly::Expected<folly::Unit, LocalErrorCode> setStreamPriority(
|
||||
StreamId id,
|
||||
@ -434,13 +434,13 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
||||
/**
|
||||
* Get the number of pending byte events for the given stream.
|
||||
*/
|
||||
FOLLY_NODISCARD size_t
|
||||
getNumByteEventCallbacksForStream(const StreamId id) const override;
|
||||
[[nodiscard]] size_t getNumByteEventCallbacksForStream(
|
||||
const StreamId id) const override;
|
||||
|
||||
/**
|
||||
* Get the number of pending byte events of specified type for given stream.
|
||||
*/
|
||||
FOLLY_NODISCARD size_t getNumByteEventCallbacksForStream(
|
||||
[[nodiscard]] size_t getNumByteEventCallbacksForStream(
|
||||
const ByteEvent::Type type,
|
||||
const StreamId id) const override;
|
||||
|
||||
@ -469,7 +469,7 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
||||
|
||||
StreamInitiator getStreamInitiator(StreamId stream) noexcept override;
|
||||
|
||||
FOLLY_NODISCARD QuicConnectionStats getConnectionsStats() const override;
|
||||
[[nodiscard]] QuicConnectionStats getConnectionsStats() const override;
|
||||
|
||||
/**
|
||||
* Returns a shared_ptr which can be used as a guard to keep this
|
||||
@ -826,7 +826,7 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
||||
|
||||
using ByteEventMap = folly::F14FastMap<StreamId, std::deque<ByteEventDetail>>;
|
||||
ByteEventMap& getByteEventMap(const ByteEvent::Type type);
|
||||
FOLLY_NODISCARD const ByteEventMap& getByteEventMapConst(
|
||||
[[nodiscard]] const ByteEventMap& getByteEventMapConst(
|
||||
const ByteEvent::Type type) const;
|
||||
|
||||
ByteEventMap deliveryCallbacks_;
|
||||
|
@ -68,7 +68,7 @@ Optional<VersionNegotiationPacket> decodeVersionNegotiation(
|
||||
* Throws with a QuicException if the data in the cursor is not a complete QUIC
|
||||
* packet or the packet could not be decoded correctly.
|
||||
*/
|
||||
folly::Expected<RegularQuicPacket, QuicError> decodeRegularPacket(
|
||||
[[nodiscard]] folly::Expected<RegularQuicPacket, QuicError> decodeRegularPacket(
|
||||
PacketHeader&& header,
|
||||
const CodecParameters& params,
|
||||
std::unique_ptr<folly::IOBuf> packetData);
|
||||
@ -77,7 +77,7 @@ folly::Expected<RegularQuicPacket, QuicError> decodeRegularPacket(
|
||||
* Parses a single frame from the queue. Throws a QuicException if the frame
|
||||
* could not be parsed.
|
||||
*/
|
||||
folly::Expected<QuicFrame, QuicError> parseFrame(
|
||||
[[nodiscard]] folly::Expected<QuicFrame, QuicError> parseFrame(
|
||||
BufQueue& queue,
|
||||
const PacketHeader& header,
|
||||
const CodecParameters& params);
|
||||
@ -86,110 +86,111 @@ folly::Expected<QuicFrame, QuicError> parseFrame(
|
||||
* The following functions decode frames. They return an Expected with error
|
||||
* when decoding fails.
|
||||
*/
|
||||
folly::Expected<PaddingFrame, QuicError> decodePaddingFrame(
|
||||
[[nodiscard]] folly::Expected<PaddingFrame, QuicError> decodePaddingFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<RstStreamFrame, QuicError> decodeRstStreamFrame(
|
||||
[[nodiscard]] folly::Expected<RstStreamFrame, QuicError> decodeRstStreamFrame(
|
||||
folly::io::Cursor& cursor,
|
||||
bool reliable);
|
||||
|
||||
folly::Expected<ConnectionCloseFrame, QuicError> decodeConnectionCloseFrame(
|
||||
[[nodiscard]] folly::Expected<ConnectionCloseFrame, QuicError>
|
||||
decodeConnectionCloseFrame(folly::io::Cursor& cursor);
|
||||
|
||||
[[nodiscard]] folly::Expected<ConnectionCloseFrame, QuicError>
|
||||
decodeApplicationClose(folly::io::Cursor& cursor);
|
||||
|
||||
[[nodiscard]] folly::Expected<MaxDataFrame, QuicError> decodeMaxDataFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<ConnectionCloseFrame, QuicError> decodeApplicationClose(
|
||||
[[nodiscard]] folly::Expected<MaxStreamDataFrame, QuicError>
|
||||
decodeMaxStreamDataFrame(folly::io::Cursor& cursor);
|
||||
|
||||
[[nodiscard]] folly::Expected<MaxStreamsFrame, QuicError>
|
||||
decodeBiDiMaxStreamsFrame(folly::io::Cursor& cursor);
|
||||
|
||||
[[nodiscard]] folly::Expected<MaxStreamsFrame, QuicError>
|
||||
decodeUniMaxStreamsFrame(folly::io::Cursor& cursor);
|
||||
|
||||
[[nodiscard]] folly::Expected<PingFrame, QuicError> decodePingFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<MaxDataFrame, QuicError> decodeMaxDataFrame(
|
||||
[[nodiscard]] folly::Expected<QuicFrame, QuicError> decodeKnobFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<MaxStreamDataFrame, QuicError> decodeMaxStreamDataFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<QuicSimpleFrame, QuicError>
|
||||
decodeAckFrequencyFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<MaxStreamsFrame, QuicError> decodeBiDiMaxStreamsFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<ImmediateAckFrame, QuicError>
|
||||
decodeImmediateAckFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<MaxStreamsFrame, QuicError> decodeUniMaxStreamsFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<DataBlockedFrame, QuicError>
|
||||
decodeDataBlockedFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<PingFrame, QuicError> decodePingFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<StreamDataBlockedFrame, QuicError>
|
||||
decodeStreamDataBlockedFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<QuicFrame, QuicError> decodeKnobFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<StreamsBlockedFrame, QuicError>
|
||||
decodeBiDiStreamsBlockedFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<QuicSimpleFrame, QuicError> decodeAckFrequencyFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<StreamsBlockedFrame, QuicError>
|
||||
decodeUniStreamsBlockedFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<ImmediateAckFrame, QuicError> decodeImmediateAckFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<NewConnectionIdFrame, QuicError>
|
||||
decodeNewConnectionIdFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<DataBlockedFrame, QuicError> decodeDataBlockedFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<StreamDataBlockedFrame, QuicError> decodeStreamDataBlockedFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<StreamsBlockedFrame, QuicError> decodeBiDiStreamsBlockedFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<StreamsBlockedFrame, QuicError> decodeUniStreamsBlockedFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<NewConnectionIdFrame, QuicError> decodeNewConnectionIdFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<RetireConnectionIdFrame, QuicError>
|
||||
[[nodiscard]] folly::Expected<RetireConnectionIdFrame, QuicError>
|
||||
decodeRetireConnectionIdFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<StopSendingFrame, QuicError> decodeStopSendingFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<StopSendingFrame, QuicError>
|
||||
decodeStopSendingFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<PathChallengeFrame, QuicError> decodePathChallengeFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<PathChallengeFrame, QuicError>
|
||||
decodePathChallengeFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<PathResponseFrame, QuicError> decodePathResponseFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<PathResponseFrame, QuicError>
|
||||
decodePathResponseFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<ReadAckFrame, QuicError> decodeAckFrame(
|
||||
[[nodiscard]] folly::Expected<ReadAckFrame, QuicError> decodeAckFrame(
|
||||
folly::io::Cursor& cursor,
|
||||
const PacketHeader& header,
|
||||
const CodecParameters& params,
|
||||
FrameType frameType = FrameType::ACK);
|
||||
|
||||
folly::Expected<ReadAckFrame, QuicError> decodeAckExtendedFrame(
|
||||
[[nodiscard]] folly::Expected<ReadAckFrame, QuicError> decodeAckExtendedFrame(
|
||||
folly::io::Cursor& cursor,
|
||||
const PacketHeader& header,
|
||||
const CodecParameters& params);
|
||||
|
||||
folly::Expected<QuicFrame, QuicError> decodeAckFrameWithReceivedTimestamps(
|
||||
[[nodiscard]] folly::Expected<QuicFrame, QuicError>
|
||||
decodeAckFrameWithReceivedTimestamps(
|
||||
folly::io::Cursor& cursor,
|
||||
const PacketHeader& header,
|
||||
const CodecParameters& params,
|
||||
FrameType frameType);
|
||||
|
||||
folly::Expected<QuicFrame, QuicError> decodeAckFrameWithECN(
|
||||
[[nodiscard]] folly::Expected<QuicFrame, QuicError> decodeAckFrameWithECN(
|
||||
folly::io::Cursor& cursor,
|
||||
const PacketHeader& header,
|
||||
const CodecParameters& params);
|
||||
|
||||
folly::Expected<ReadStreamFrame, QuicError> decodeStreamFrame(
|
||||
[[nodiscard]] folly::Expected<ReadStreamFrame, QuicError> decodeStreamFrame(
|
||||
BufQueue& queue,
|
||||
StreamTypeField frameTypeField,
|
||||
bool isGroupFrame = false);
|
||||
|
||||
folly::Expected<ReadCryptoFrame, QuicError> decodeCryptoFrame(
|
||||
[[nodiscard]] folly::Expected<ReadCryptoFrame, QuicError> decodeCryptoFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<ReadNewTokenFrame, QuicError> decodeNewTokenFrame(
|
||||
[[nodiscard]] folly::Expected<ReadNewTokenFrame, QuicError> decodeNewTokenFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<HandshakeDoneFrame, QuicError> decodeHandshakeDoneFrame(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<HandshakeDoneFrame, QuicError>
|
||||
decodeHandshakeDoneFrame(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<uint64_t, TransportErrorCode> parsePlaintextRetryOrNewToken(
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<uint64_t, TransportErrorCode>
|
||||
parsePlaintextRetryOrNewToken(folly::io::Cursor& cursor);
|
||||
|
||||
folly::Expected<DatagramFrame, QuicError> decodeDatagramFrame(
|
||||
[[nodiscard]] folly::Expected<DatagramFrame, QuicError> decodeDatagramFrame(
|
||||
BufQueue& queue,
|
||||
bool hasLen);
|
||||
|
||||
@ -199,7 +200,7 @@ folly::Expected<DatagramFrame, QuicError> decodeDatagramFrame(
|
||||
* cursor: points to the byte just past initialByte. After parsing, cursor
|
||||
* will be moved to the byte right after Source Connection ID.
|
||||
*/
|
||||
folly::Expected<ParsedLongHeaderInvariant, TransportErrorCode>
|
||||
[[nodiscard]] folly::Expected<ParsedLongHeaderInvariant, TransportErrorCode>
|
||||
parseLongHeaderInvariant(uint8_t initalByte, folly::io::Cursor& cursor);
|
||||
|
||||
struct PacketLength {
|
||||
@ -245,29 +246,30 @@ std::pair<PacketNum, size_t> parsePacketNumber(
|
||||
PacketNum expectedNextPacketNum);
|
||||
|
||||
// cursor: has to be point to the byte just past initialByte
|
||||
folly::Expected<ParsedLongHeaderResult, TransportErrorCode> parseLongHeader(
|
||||
uint8_t initialByte,
|
||||
folly::io::Cursor& cursor);
|
||||
[[nodiscard]] folly::Expected<ParsedLongHeaderResult, TransportErrorCode>
|
||||
parseLongHeader(uint8_t initialByte, folly::io::Cursor& cursor);
|
||||
|
||||
// nodeType: Determine if we allow 0-len dst connection ids.
|
||||
folly::Expected<ParsedLongHeader, TransportErrorCode> parseLongHeaderVariants(
|
||||
[[nodiscard]] folly::Expected<ParsedLongHeader, TransportErrorCode>
|
||||
parseLongHeaderVariants(
|
||||
LongHeader::Types type,
|
||||
ParsedLongHeaderInvariant longHeaderInvariant,
|
||||
folly::io::Cursor& cursor,
|
||||
QuicNodeType nodeType = QuicNodeType::Server);
|
||||
|
||||
folly::Expected<ShortHeaderInvariant, TransportErrorCode>
|
||||
[[nodiscard]] folly::Expected<ShortHeaderInvariant, TransportErrorCode>
|
||||
parseShortHeaderInvariants(
|
||||
uint8_t initialByte,
|
||||
folly::io::Cursor& cursor,
|
||||
size_t dstConnIdSize = kDefaultConnectionIdSize);
|
||||
|
||||
folly::Expected<ShortHeader, TransportErrorCode> parseShortHeader(
|
||||
[[nodiscard]] folly::Expected<ShortHeader, TransportErrorCode> parseShortHeader(
|
||||
uint8_t initialByte,
|
||||
folly::io::Cursor& cursor,
|
||||
size_t dstConnIdSize = kDefaultConnectionIdSize);
|
||||
|
||||
folly::Expected<uint64_t, QuicError> convertEncodedDurationToMicroseconds(
|
||||
[[nodiscard]] folly::Expected<uint64_t, QuicError>
|
||||
convertEncodedDurationToMicroseconds(
|
||||
uint8_t exponentToUse,
|
||||
uint64_t delay) noexcept;
|
||||
} // namespace quic
|
||||
|
@ -59,7 +59,7 @@ class PacketBuilderInterface {
|
||||
body(std::move(bodyIn)) {}
|
||||
};
|
||||
|
||||
FOLLY_NODISCARD virtual uint32_t remainingSpaceInPkt() const = 0;
|
||||
[[nodiscard]] virtual uint32_t remainingSpaceInPkt() const = 0;
|
||||
|
||||
virtual void encodePacketHeader() = 0;
|
||||
|
||||
@ -87,7 +87,7 @@ class PacketBuilderInterface {
|
||||
virtual void markNonEmpty() = 0;
|
||||
|
||||
// Returns the packet header for the current packet.
|
||||
FOLLY_NODISCARD virtual const PacketHeader& getPacketHeader() const = 0;
|
||||
[[nodiscard]] virtual const PacketHeader& getPacketHeader() const = 0;
|
||||
|
||||
virtual void accountForCipherOverhead(uint8_t overhead) = 0;
|
||||
|
||||
@ -95,7 +95,7 @@ class PacketBuilderInterface {
|
||||
* Whether the packet builder is able to build a packet. This should be
|
||||
* checked right after the creation of a packet builder object.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual bool canBuildPacket() const noexcept = 0;
|
||||
[[nodiscard]] virtual bool canBuildPacket() const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Return an estimated header bytes count.
|
||||
@ -106,9 +106,9 @@ class PacketBuilderInterface {
|
||||
* of header bytes already written, the maximum possible packet length field
|
||||
* bytes count and packet number field bytes count.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual uint32_t getHeaderBytes() const = 0;
|
||||
[[nodiscard]] virtual uint32_t getHeaderBytes() const = 0;
|
||||
|
||||
FOLLY_NODISCARD virtual bool hasFramesPending() const = 0;
|
||||
[[nodiscard]] virtual bool hasFramesPending() const = 0;
|
||||
|
||||
virtual Packet buildPacket() && = 0;
|
||||
|
||||
@ -130,7 +130,7 @@ class InplaceQuicPacketBuilder final : public PacketBuilderInterface {
|
||||
uint8_t frameHint = 0);
|
||||
|
||||
// PacketBuilderInterface
|
||||
FOLLY_NODISCARD uint32_t remainingSpaceInPkt() const override;
|
||||
[[nodiscard]] uint32_t remainingSpaceInPkt() const override;
|
||||
|
||||
void encodePacketHeader() override;
|
||||
|
||||
@ -155,17 +155,17 @@ class InplaceQuicPacketBuilder final : public PacketBuilderInterface {
|
||||
void appendFrame(QuicWriteFrame frame) override;
|
||||
void appendPaddingFrame() override;
|
||||
void markNonEmpty() override;
|
||||
FOLLY_NODISCARD const PacketHeader& getPacketHeader() const override;
|
||||
[[nodiscard]] const PacketHeader& getPacketHeader() const override;
|
||||
|
||||
PacketBuilderInterface::Packet buildPacket() && override;
|
||||
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept override;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept override;
|
||||
|
||||
void accountForCipherOverhead(uint8_t overhead) noexcept override;
|
||||
|
||||
FOLLY_NODISCARD uint32_t getHeaderBytes() const override;
|
||||
[[nodiscard]] uint32_t getHeaderBytes() const override;
|
||||
|
||||
FOLLY_NODISCARD bool hasFramesPending() const override;
|
||||
[[nodiscard]] bool hasFramesPending() const override;
|
||||
|
||||
void releaseOutputBuffer() && override;
|
||||
|
||||
@ -208,12 +208,12 @@ class RegularQuicPacketBuilder final : public PacketBuilderInterface {
|
||||
PacketNum largestAckedPacketNum,
|
||||
uint8_t frameHint = 0);
|
||||
|
||||
FOLLY_NODISCARD uint32_t getHeaderBytes() const override;
|
||||
[[nodiscard]] uint32_t getHeaderBytes() const override;
|
||||
|
||||
void encodePacketHeader() override;
|
||||
|
||||
// PacketBuilderInterface
|
||||
FOLLY_NODISCARD uint32_t remainingSpaceInPkt() const override;
|
||||
[[nodiscard]] uint32_t remainingSpaceInPkt() const override;
|
||||
|
||||
void writeBE(uint8_t data) override;
|
||||
void writeBE(uint16_t data) override;
|
||||
@ -237,18 +237,18 @@ class RegularQuicPacketBuilder final : public PacketBuilderInterface {
|
||||
void appendFrame(QuicWriteFrame frame) override;
|
||||
void appendPaddingFrame() override;
|
||||
void markNonEmpty() override;
|
||||
FOLLY_NODISCARD const PacketHeader& getPacketHeader() const override;
|
||||
[[nodiscard]] const PacketHeader& getPacketHeader() const override;
|
||||
|
||||
Packet buildPacket() && override;
|
||||
/**
|
||||
* Whether the packet builder is able to build a packet. This should be
|
||||
* checked right after the creation of a packet builder object.
|
||||
*/
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept override;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept override;
|
||||
|
||||
void accountForCipherOverhead(uint8_t overhead) noexcept override;
|
||||
|
||||
FOLLY_NODISCARD bool hasFramesPending() const override;
|
||||
[[nodiscard]] bool hasFramesPending() const override;
|
||||
|
||||
void releaseOutputBuffer() && override;
|
||||
|
||||
@ -283,7 +283,7 @@ class WrapperPacketBuilderInterface {
|
||||
|
||||
virtual ~WrapperPacketBuilderInterface() = default;
|
||||
|
||||
FOLLY_NODISCARD virtual bool canBuildPacket() const noexcept = 0;
|
||||
[[nodiscard]] virtual bool canBuildPacket() const noexcept = 0;
|
||||
|
||||
virtual Packet buildPacket() && = 0;
|
||||
};
|
||||
@ -307,7 +307,7 @@ class RegularSizeEnforcedPacketBuilder : public WrapperPacketBuilderInterface {
|
||||
* Returns true when packet has short header, and that enforced size >
|
||||
* current packet size + cipher overhead, otherwise false
|
||||
*/
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept override;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept override;
|
||||
|
||||
Packet buildPacket() && override;
|
||||
|
||||
@ -341,7 +341,7 @@ class InplaceSizeEnforcedPacketBuilder : public WrapperPacketBuilderInterface {
|
||||
* packet size + cipher oveahead and that iobuf has enough tailroom,
|
||||
* otherwise false
|
||||
*/
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept override;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept override;
|
||||
|
||||
Packet buildPacket() && override;
|
||||
|
||||
@ -370,12 +370,12 @@ class VersionNegotiationPacketBuilder {
|
||||
* Whether the packet builder is able to build a packet. This should be
|
||||
* checked right after the creation of a packet builder object.
|
||||
*/
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept;
|
||||
|
||||
private:
|
||||
void writeVersionNegotiationPacket(const std::vector<QuicVersion>& versions);
|
||||
|
||||
FOLLY_NODISCARD uint8_t generateRandomPacketType() const;
|
||||
[[nodiscard]] uint8_t generateRandomPacketType() const;
|
||||
|
||||
private:
|
||||
uint32_t remainingBytes_;
|
||||
@ -429,7 +429,7 @@ class RetryPacketBuilder {
|
||||
* Whether the RetryPacketBuilder is able to build a packet. This should be
|
||||
* checked right after the creation of the RetryPacketBuilder.
|
||||
*/
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept;
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept;
|
||||
|
||||
private:
|
||||
void writeRetryPacket();
|
||||
@ -475,7 +475,7 @@ class PacketBuilderWrapper : public PacketBuilderInterface {
|
||||
? 0
|
||||
: builder.remainingSpaceInPkt() - writableBytes) {}
|
||||
|
||||
FOLLY_NODISCARD uint32_t remainingSpaceInPkt() const override {
|
||||
[[nodiscard]] uint32_t remainingSpaceInPkt() const override {
|
||||
return builder.remainingSpaceInPkt() > diff
|
||||
? builder.remainingSpaceInPkt() - diff
|
||||
: 0;
|
||||
@ -548,7 +548,7 @@ class PacketBuilderWrapper : public PacketBuilderInterface {
|
||||
builder.push(data, len);
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD const PacketHeader& getPacketHeader() const override {
|
||||
[[nodiscard]] const PacketHeader& getPacketHeader() const override {
|
||||
return builder.getPacketHeader();
|
||||
}
|
||||
|
||||
@ -560,15 +560,15 @@ class PacketBuilderWrapper : public PacketBuilderInterface {
|
||||
builder.accountForCipherOverhead(overhead);
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool canBuildPacket() const noexcept override {
|
||||
[[nodiscard]] bool canBuildPacket() const noexcept override {
|
||||
return builder.canBuildPacket();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD uint32_t getHeaderBytes() const override {
|
||||
[[nodiscard]] uint32_t getHeaderBytes() const override {
|
||||
return builder.getHeaderBytes();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool hasFramesPending() const override {
|
||||
[[nodiscard]] bool hasFramesPending() const override {
|
||||
return builder.hasFramesPending();
|
||||
}
|
||||
|
||||
|
@ -794,9 +794,9 @@ struct QuicAddrValidationToken {
|
||||
QuicAddrValidationToken& operator=(const QuicAddrValidationToken& other) =
|
||||
default;
|
||||
|
||||
FOLLY_NODISCARD Buf getPlaintextToken() const;
|
||||
FOLLY_NODISCARD virtual TokenType getTokenType() const = 0;
|
||||
FOLLY_NODISCARD virtual Buf genAeadAssocData() const = 0;
|
||||
[[nodiscard]] Buf getPlaintextToken() const;
|
||||
[[nodiscard]] virtual TokenType getTokenType() const = 0;
|
||||
[[nodiscard]] virtual Buf genAeadAssocData() const = 0;
|
||||
virtual ~QuicAddrValidationToken() = default;
|
||||
|
||||
folly::IPAddress clientIp;
|
||||
@ -820,11 +820,11 @@ struct RetryToken : QuicAddrValidationToken {
|
||||
|
||||
RetryToken& operator=(const RetryToken& other) = default;
|
||||
|
||||
FOLLY_NODISCARD TokenType getTokenType() const override {
|
||||
[[nodiscard]] TokenType getTokenType() const override {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD Buf genAeadAssocData() const override;
|
||||
[[nodiscard]] Buf genAeadAssocData() const override;
|
||||
|
||||
ConnectionId originalDstConnId;
|
||||
uint16_t clientPort;
|
||||
@ -845,11 +845,11 @@ struct NewToken : QuicAddrValidationToken {
|
||||
|
||||
NewToken& operator=(const NewToken& other) = default;
|
||||
|
||||
FOLLY_NODISCARD TokenType getTokenType() const override {
|
||||
[[nodiscard]] TokenType getTokenType() const override {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD Buf genAeadAssocData() const override;
|
||||
[[nodiscard]] Buf genAeadAssocData() const override;
|
||||
|
||||
bool operator==(const NewToken& other) const {
|
||||
return clientIp == other.clientIp && timestampInMs == other.timestampInMs;
|
||||
|
@ -589,10 +589,12 @@ TEST_F(DecodeTest, AckFrameAdditionalBlocksOverflow) {
|
||||
firstAckBlockLength,
|
||||
ackBlocks);
|
||||
folly::io::Cursor cursor(result.get());
|
||||
decodeAckFrame(
|
||||
cursor,
|
||||
makeHeader(),
|
||||
CodecParameters(kDefaultAckDelayExponent, QuicVersion::MVFST));
|
||||
ASSERT_FALSE(
|
||||
decodeAckFrame(
|
||||
cursor,
|
||||
makeHeader(),
|
||||
CodecParameters(kDefaultAckDelayExponent, QuicVersion::MVFST))
|
||||
.hasError());
|
||||
}
|
||||
|
||||
TEST_F(DecodeTest, AckFrameMissingFields) {
|
||||
@ -944,14 +946,14 @@ TEST_F(DecodeTest, PaddingFrameTest) {
|
||||
memset(buf->writableData(), 0, 1);
|
||||
|
||||
folly::io::Cursor cursor(buf.get());
|
||||
decodePaddingFrame(cursor);
|
||||
ASSERT_FALSE(decodePaddingFrame(cursor).hasError());
|
||||
}
|
||||
|
||||
TEST_F(DecodeTest, PaddingFrameNoBytesTest) {
|
||||
auto buf = folly::IOBuf::create(sizeof(UnderlyingFrameType));
|
||||
|
||||
folly::io::Cursor cursor(buf.get());
|
||||
decodePaddingFrame(cursor);
|
||||
ASSERT_FALSE(decodePaddingFrame(cursor).hasError());
|
||||
}
|
||||
|
||||
TEST_F(DecodeTest, DecodeMultiplePaddingInterleavedTest) {
|
||||
@ -963,7 +965,7 @@ TEST_F(DecodeTest, DecodeMultiplePaddingInterleavedTest) {
|
||||
memset(buf->writableData() + 10, 5, 1);
|
||||
|
||||
folly::io::Cursor cursor(buf.get());
|
||||
decodePaddingFrame(cursor);
|
||||
ASSERT_FALSE(decodePaddingFrame(cursor).hasError());
|
||||
// If we encountered an interleaved frame, leave the whole thing
|
||||
// as is
|
||||
EXPECT_EQ(cursor.totalLength(), 11);
|
||||
@ -975,7 +977,7 @@ TEST_F(DecodeTest, DecodeMultiplePaddingTest) {
|
||||
memset(buf->writableData(), 0, 10);
|
||||
|
||||
folly::io::Cursor cursor(buf.get());
|
||||
decodePaddingFrame(cursor);
|
||||
ASSERT_FALSE(decodePaddingFrame(cursor).hasError());
|
||||
EXPECT_EQ(cursor.totalLength(), 0);
|
||||
}
|
||||
|
||||
|
@ -92,11 +92,11 @@ struct CircularDeque {
|
||||
CircularDequeIterator(const CircularDeque<U>* deque, size_type index)
|
||||
: deque_(deque), index_(index) {}
|
||||
|
||||
FOLLY_NODISCARD U& dereference() const {
|
||||
[[nodiscard]] U& dereference() const {
|
||||
return const_cast<U&>(deque_->storage_[index_]);
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool equal(const CircularDequeIterator<U>& other) const {
|
||||
[[nodiscard]] bool equal(const CircularDequeIterator<U>& other) const {
|
||||
return deque_ == other.deque_ && index_ == other.index_;
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ struct CircularDeque {
|
||||
}
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD difference_type
|
||||
distance_to(const CircularDequeIterator<U>& other) const {
|
||||
[[nodiscard]] difference_type distance_to(
|
||||
const CircularDequeIterator<U>& other) const {
|
||||
if (index_ == other.index_) {
|
||||
return 0;
|
||||
}
|
||||
@ -162,7 +162,7 @@ struct CircularDeque {
|
||||
friend struct CircularDeque<U>;
|
||||
friend struct CircularDeque<typename std::remove_const<U>::type>;
|
||||
|
||||
FOLLY_NODISCARD inline bool wrapped() const {
|
||||
[[nodiscard]] inline bool wrapped() const {
|
||||
return deque_->begin_ > deque_->end_;
|
||||
}
|
||||
|
||||
@ -175,10 +175,10 @@ struct CircularDeque {
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
FOLLY_NODISCARD bool empty() const noexcept;
|
||||
FOLLY_NODISCARD size_type size() const noexcept;
|
||||
[[nodiscard]] bool empty() const noexcept;
|
||||
[[nodiscard]] size_type size() const noexcept;
|
||||
|
||||
FOLLY_NODISCARD size_type max_size() const noexcept;
|
||||
[[nodiscard]] size_type max_size() const noexcept;
|
||||
void resize(size_type count);
|
||||
// Missing compared to std::deque:
|
||||
// resize(size_t, const T&);
|
||||
@ -186,25 +186,25 @@ struct CircularDeque {
|
||||
|
||||
const_reference operator[](size_type index) const;
|
||||
reference operator[](size_type index);
|
||||
FOLLY_NODISCARD const_reference at(size_type index) const;
|
||||
FOLLY_NODISCARD reference at(size_type index);
|
||||
FOLLY_NODISCARD const_reference front() const;
|
||||
FOLLY_NODISCARD reference front();
|
||||
FOLLY_NODISCARD const_reference back() const;
|
||||
FOLLY_NODISCARD reference back();
|
||||
[[nodiscard]] const_reference at(size_type index) const;
|
||||
[[nodiscard]] reference at(size_type index);
|
||||
[[nodiscard]] const_reference front() const;
|
||||
[[nodiscard]] reference front();
|
||||
[[nodiscard]] const_reference back() const;
|
||||
[[nodiscard]] reference back();
|
||||
|
||||
FOLLY_NODISCARD iterator begin() noexcept;
|
||||
FOLLY_NODISCARD const_iterator begin() const noexcept;
|
||||
FOLLY_NODISCARD iterator end() noexcept;
|
||||
FOLLY_NODISCARD const_iterator end() const noexcept;
|
||||
FOLLY_NODISCARD const_iterator cbegin() const noexcept;
|
||||
FOLLY_NODISCARD const_iterator cend() const noexcept;
|
||||
FOLLY_NODISCARD reverse_iterator rbegin() noexcept;
|
||||
FOLLY_NODISCARD const_reverse_iterator rbegin() const noexcept;
|
||||
FOLLY_NODISCARD const_reverse_iterator crbegin() const noexcept;
|
||||
FOLLY_NODISCARD reverse_iterator rend() noexcept;
|
||||
FOLLY_NODISCARD const_reverse_iterator rend() const noexcept;
|
||||
FOLLY_NODISCARD const_reverse_iterator crend() const noexcept;
|
||||
[[nodiscard]] iterator begin() noexcept;
|
||||
[[nodiscard]] const_iterator begin() const noexcept;
|
||||
[[nodiscard]] iterator end() noexcept;
|
||||
[[nodiscard]] const_iterator end() const noexcept;
|
||||
[[nodiscard]] const_iterator cbegin() const noexcept;
|
||||
[[nodiscard]] const_iterator cend() const noexcept;
|
||||
[[nodiscard]] reverse_iterator rbegin() noexcept;
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const noexcept;
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const noexcept;
|
||||
[[nodiscard]] reverse_iterator rend() noexcept;
|
||||
[[nodiscard]] const_reverse_iterator rend() const noexcept;
|
||||
[[nodiscard]] const_reverse_iterator crend() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
reference emplace_front(Args&&... args);
|
||||
@ -235,7 +235,7 @@ struct CircularDeque {
|
||||
void swap(CircularDeque<T>& other) noexcept;
|
||||
|
||||
private:
|
||||
FOLLY_NODISCARD bool needSpace() const noexcept;
|
||||
[[nodiscard]] bool needSpace() const noexcept;
|
||||
|
||||
template <
|
||||
typename U = T,
|
||||
|
@ -35,7 +35,7 @@ class EnumArray : public std::array<V, size_t(K::MAX) + 1> {
|
||||
}
|
||||
|
||||
// Returns all valid values for the enum
|
||||
FOLLY_NODISCARD constexpr std::array<K, ArraySize> keys() const {
|
||||
[[nodiscard]] constexpr std::array<K, ArraySize> keys() const {
|
||||
return keyArrayHelper(std::make_integer_sequence<IntType, ArraySize>{});
|
||||
}
|
||||
|
||||
|
@ -38,17 +38,17 @@ class Bbr2CongestionController : public CongestionController {
|
||||
const AckEvent* FOLLY_NULLABLE ackEvent,
|
||||
const LossEvent* FOLLY_NULLABLE lossEvent) override;
|
||||
|
||||
FOLLY_NODISCARD uint64_t getWritableBytes() const noexcept override;
|
||||
[[nodiscard]] uint64_t getWritableBytes() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD uint64_t getCongestionWindow() const noexcept override;
|
||||
[[nodiscard]] uint64_t getCongestionWindow() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD CongestionControlType type() const noexcept override;
|
||||
[[nodiscard]] CongestionControlType type() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD bool isAppLimited() const override;
|
||||
[[nodiscard]] bool isAppLimited() const override;
|
||||
|
||||
FOLLY_NODISCARD Optional<Bandwidth> getBandwidth() const override;
|
||||
[[nodiscard]] Optional<Bandwidth> getBandwidth() const override;
|
||||
|
||||
FOLLY_NODISCARD uint64_t getBDP() const override;
|
||||
[[nodiscard]] uint64_t getBDP() const override;
|
||||
|
||||
void setAppLimited() noexcept override;
|
||||
|
||||
|
@ -108,20 +108,20 @@ struct CongestionController {
|
||||
* Return the number of bytes that the congestion controller
|
||||
* will allow you to write.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual uint64_t getWritableBytes() const = 0;
|
||||
[[nodiscard]] virtual uint64_t getWritableBytes() const = 0;
|
||||
|
||||
/**
|
||||
* Return the number of bytes of cwnd of the congestion
|
||||
* controller.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual uint64_t getCongestionWindow() const = 0;
|
||||
[[nodiscard]] virtual uint64_t getCongestionWindow() const = 0;
|
||||
|
||||
/**
|
||||
* Return the congestion controller's bandwidth estimate, if available.
|
||||
*
|
||||
* Unit is bits-per-second (bps).
|
||||
*/
|
||||
FOLLY_NODISCARD virtual Optional<Bandwidth> getBandwidth() const {
|
||||
[[nodiscard]] virtual Optional<Bandwidth> getBandwidth() const {
|
||||
return none;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ struct CongestionController {
|
||||
*
|
||||
* Unit is bytes.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual uint64_t getBDP() const {
|
||||
[[nodiscard]] virtual uint64_t getBDP() const {
|
||||
return getCongestionWindow();
|
||||
}
|
||||
|
||||
@ -150,20 +150,20 @@ struct CongestionController {
|
||||
*/
|
||||
virtual void setAppLimited() = 0;
|
||||
|
||||
FOLLY_NODISCARD virtual CongestionControlType type() const = 0;
|
||||
[[nodiscard]] virtual CongestionControlType type() const = 0;
|
||||
|
||||
/**
|
||||
* Whether the congestion controller thinks it's currently in app-limited
|
||||
* state.
|
||||
*/
|
||||
FOLLY_NODISCARD virtual bool isAppLimited() const = 0;
|
||||
[[nodiscard]] virtual bool isAppLimited() const = 0;
|
||||
|
||||
virtual void getStats(CongestionControllerStats& stats) const = 0;
|
||||
|
||||
/**
|
||||
* Get current state of congestion controller.
|
||||
*/
|
||||
FOLLY_NODISCARD State getState() const {
|
||||
[[nodiscard]] State getState() const {
|
||||
State state;
|
||||
state.congestionWindowBytes = getCongestionWindow();
|
||||
state.writableBytes = getWritableBytes();
|
||||
|
@ -31,17 +31,17 @@ class Copa2 : public CongestionController {
|
||||
onPacketAckOrLoss(ack.get_pointer(), loss.get_pointer());
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD uint64_t getWritableBytes() const noexcept override;
|
||||
FOLLY_NODISCARD uint64_t getCongestionWindow() const noexcept override;
|
||||
FOLLY_NODISCARD CongestionControlType type() const noexcept override;
|
||||
[[nodiscard]] uint64_t getWritableBytes() const noexcept override;
|
||||
[[nodiscard]] uint64_t getCongestionWindow() const noexcept override;
|
||||
[[nodiscard]] CongestionControlType type() const noexcept override;
|
||||
|
||||
void setAppIdle(bool, TimePoint) noexcept override;
|
||||
void setAppLimited() override;
|
||||
FOLLY_NODISCARD bool isAppLimited() const noexcept override;
|
||||
[[nodiscard]] bool isAppLimited() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD bool inLossyMode() const noexcept;
|
||||
FOLLY_NODISCARD bool inProbeRtt() const noexcept;
|
||||
FOLLY_NODISCARD uint64_t getBytesInFlight() const noexcept;
|
||||
[[nodiscard]] bool inLossyMode() const noexcept;
|
||||
[[nodiscard]] bool inProbeRtt() const noexcept;
|
||||
[[nodiscard]] uint64_t getBytesInFlight() const noexcept;
|
||||
|
||||
void getStats(CongestionControllerStats& stats) const override;
|
||||
|
||||
|
@ -53,13 +53,13 @@ struct StaticCwndCongestionController : public CongestionController {
|
||||
const AckEvent* FOLLY_NULLABLE ackEvent,
|
||||
const LossEvent* FOLLY_NULLABLE lossEvent) override;
|
||||
|
||||
FOLLY_NODISCARD uint64_t getWritableBytes() const noexcept override;
|
||||
[[nodiscard]] uint64_t getWritableBytes() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD uint64_t getCongestionWindow() const noexcept override;
|
||||
[[nodiscard]] uint64_t getCongestionWindow() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD CongestionControlType type() const noexcept override;
|
||||
[[nodiscard]] CongestionControlType type() const noexcept override;
|
||||
|
||||
FOLLY_NODISCARD bool isAppLimited() const override;
|
||||
[[nodiscard]] bool isAppLimited() const override;
|
||||
|
||||
void setAppLimited() noexcept override;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class DSRStreamFrameScheduler {
|
||||
public:
|
||||
explicit DSRStreamFrameScheduler(QuicServerConnectionState& conn);
|
||||
|
||||
FOLLY_NODISCARD bool hasPendingData() const;
|
||||
[[nodiscard]] bool hasPendingData() const;
|
||||
|
||||
struct SchedulingResult {
|
||||
bool writeSuccess{false};
|
||||
|
@ -30,7 +30,7 @@ class PaddingFrameLog : public QLogFrame {
|
||||
explicit PaddingFrameLog(uint64_t numFramesIn) : numFrames{numFramesIn} {}
|
||||
|
||||
~PaddingFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class RstStreamFrameLog : public QLogFrame {
|
||||
@ -51,7 +51,7 @@ class RstStreamFrameLog : public QLogFrame {
|
||||
reliableOffset{reliableOffsetIn} {}
|
||||
|
||||
~RstStreamFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class ConnectionCloseFrameLog : public QLogFrame {
|
||||
@ -69,7 +69,7 @@ class ConnectionCloseFrameLog : public QLogFrame {
|
||||
closingFrameType{closingFrameTypeIn} {}
|
||||
|
||||
~ConnectionCloseFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class MaxDataFrameLog : public QLogFrame {
|
||||
@ -80,7 +80,7 @@ class MaxDataFrameLog : public QLogFrame {
|
||||
: maximumData{maximumDataIn} {}
|
||||
|
||||
~MaxDataFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class MaxStreamDataFrameLog : public QLogFrame {
|
||||
@ -92,7 +92,7 @@ class MaxStreamDataFrameLog : public QLogFrame {
|
||||
: streamId{streamIdIn}, maximumData{maximumDataIn} {}
|
||||
|
||||
~MaxStreamDataFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class MaxStreamsFrameLog : public QLogFrame {
|
||||
@ -104,7 +104,7 @@ class MaxStreamsFrameLog : public QLogFrame {
|
||||
: maxStreams{maxStreamsIn}, isForBidirectional{isForBidirectionalIn} {}
|
||||
|
||||
~MaxStreamsFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class StreamsBlockedFrameLog : public QLogFrame {
|
||||
@ -116,14 +116,14 @@ class StreamsBlockedFrameLog : public QLogFrame {
|
||||
: streamLimit{streamLimitIn}, isForBidirectional{isForBidirectionalIn} {}
|
||||
|
||||
~StreamsBlockedFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class PingFrameLog : public QLogFrame {
|
||||
public:
|
||||
PingFrameLog() = default;
|
||||
~PingFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class DataBlockedFrameLog : public QLogFrame {
|
||||
@ -133,7 +133,7 @@ class DataBlockedFrameLog : public QLogFrame {
|
||||
explicit DataBlockedFrameLog(uint64_t dataLimitIn) : dataLimit{dataLimitIn} {}
|
||||
|
||||
~DataBlockedFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class NewTokenFrameLog : public QLogFrame {
|
||||
@ -143,7 +143,7 @@ class NewTokenFrameLog : public QLogFrame {
|
||||
explicit NewTokenFrameLog(std::string tokenIn) : token(std::move(tokenIn)) {}
|
||||
|
||||
~NewTokenFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class KnobFrameLog : public QLogFrame {
|
||||
@ -159,7 +159,7 @@ class KnobFrameLog : public QLogFrame {
|
||||
: knobSpace(knobSpaceIn), knobId(knobIdIn), knobBlobLen(knobBlobLenIn) {}
|
||||
|
||||
~KnobFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class AckFrequencyFrameLog : public QLogFrame {
|
||||
@ -180,14 +180,14 @@ class AckFrequencyFrameLog : public QLogFrame {
|
||||
reorderThreshold(reorderThresholdIn) {}
|
||||
|
||||
~AckFrequencyFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class ImmediateAckFrameLog : public QLogFrame {
|
||||
public:
|
||||
ImmediateAckFrameLog() = default;
|
||||
~ImmediateAckFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class StreamDataBlockedFrameLog : public QLogFrame {
|
||||
@ -199,7 +199,7 @@ class StreamDataBlockedFrameLog : public QLogFrame {
|
||||
: streamId{streamIdIn}, dataLimit{dataLimitIn} {}
|
||||
|
||||
~StreamDataBlockedFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class ReadAckFrameLog : public QLogFrame {
|
||||
@ -235,7 +235,7 @@ class ReadAckFrameLog : public QLogFrame {
|
||||
ecnCECount(ecnCECountIn) {}
|
||||
|
||||
~ReadAckFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class WriteAckFrameLog : public QLogFrame {
|
||||
@ -271,7 +271,7 @@ class WriteAckFrameLog : public QLogFrame {
|
||||
ecnCECount(ecnCECountIn) {}
|
||||
|
||||
~WriteAckFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class StreamFrameLog : public QLogFrame {
|
||||
@ -290,7 +290,7 @@ class StreamFrameLog : public QLogFrame {
|
||||
|
||||
~StreamFrameLog() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class CryptoFrameLog : public QLogFrame {
|
||||
@ -302,7 +302,7 @@ class CryptoFrameLog : public QLogFrame {
|
||||
: offset{offsetIn}, len{lenIn} {}
|
||||
|
||||
~CryptoFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class StopSendingFrameLog : public QLogFrame {
|
||||
@ -314,7 +314,7 @@ class StopSendingFrameLog : public QLogFrame {
|
||||
: streamId{streamIdIn}, errorCode{errorCodeIn} {}
|
||||
|
||||
~StopSendingFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class PathChallengeFrameLog : public QLogFrame {
|
||||
@ -324,7 +324,7 @@ class PathChallengeFrameLog : public QLogFrame {
|
||||
explicit PathChallengeFrameLog(uint64_t pathDataIn) : pathData{pathDataIn} {}
|
||||
|
||||
~PathChallengeFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class PathResponseFrameLog : public QLogFrame {
|
||||
@ -334,7 +334,7 @@ class PathResponseFrameLog : public QLogFrame {
|
||||
explicit PathResponseFrameLog(uint64_t pathDataIn) : pathData{pathDataIn} {}
|
||||
|
||||
~PathResponseFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class NewConnectionIdFrameLog : public QLogFrame {
|
||||
@ -346,7 +346,7 @@ class NewConnectionIdFrameLog : public QLogFrame {
|
||||
: sequence{sequenceIn}, token{tokenIn} {}
|
||||
|
||||
~NewConnectionIdFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class RetireConnectionIdFrameLog : public QLogFrame {
|
||||
@ -356,21 +356,21 @@ class RetireConnectionIdFrameLog : public QLogFrame {
|
||||
RetireConnectionIdFrameLog(uint64_t sequenceIn) : sequence(sequenceIn) {}
|
||||
|
||||
~RetireConnectionIdFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class ReadNewTokenFrameLog : public QLogFrame {
|
||||
public:
|
||||
ReadNewTokenFrameLog() = default;
|
||||
~ReadNewTokenFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class HandshakeDoneFrameLog : public QLogFrame {
|
||||
public:
|
||||
HandshakeDoneFrameLog() = default;
|
||||
~HandshakeDoneFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class DatagramFrameLog : public QLogFrame {
|
||||
@ -380,7 +380,7 @@ class DatagramFrameLog : public QLogFrame {
|
||||
explicit DatagramFrameLog(uint64_t lenIn) : len(lenIn) {}
|
||||
|
||||
~DatagramFrameLog() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class VersionNegotiationLog {
|
||||
@ -391,7 +391,7 @@ class VersionNegotiationLog {
|
||||
: versions{versionsIn} {}
|
||||
|
||||
~VersionNegotiationLog() = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const;
|
||||
};
|
||||
|
||||
enum class QLogEventType : uint32_t {
|
||||
@ -441,7 +441,7 @@ class QLogPacketEvent : public QLogEvent {
|
||||
PacketNum packetNum{0};
|
||||
uint64_t packetSize{0};
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogVersionNegotiationEvent : public QLogEvent {
|
||||
@ -452,7 +452,7 @@ class QLogVersionNegotiationEvent : public QLogEvent {
|
||||
std::string packetType;
|
||||
uint64_t packetSize{0};
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogRetryEvent : public QLogEvent {
|
||||
@ -464,7 +464,7 @@ class QLogRetryEvent : public QLogEvent {
|
||||
uint64_t packetSize{0};
|
||||
uint64_t tokenSize{0};
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogConnectionCloseEvent : public QLogEvent {
|
||||
@ -481,7 +481,7 @@ class QLogConnectionCloseEvent : public QLogEvent {
|
||||
bool drainConnection;
|
||||
bool sendCloseImmediately;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogTransportSummaryEvent : public QLogEvent {
|
||||
@ -540,7 +540,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
|
||||
std::string pskType;
|
||||
std::string echStatus;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogCongestionMetricUpdateEvent : public QLogEvent {
|
||||
@ -559,7 +559,7 @@ class QLogCongestionMetricUpdateEvent : public QLogEvent {
|
||||
std::string state;
|
||||
std::string recoveryState;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogAppLimitedUpdateEvent : public QLogEvent {
|
||||
@ -569,7 +569,7 @@ class QLogAppLimitedUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogAppLimitedUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
bool limited;
|
||||
};
|
||||
@ -582,7 +582,7 @@ class QLogBandwidthEstUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogBandwidthEstUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
uint64_t bytes;
|
||||
std::chrono::microseconds interval;
|
||||
@ -598,7 +598,7 @@ class QLogPacingMetricUpdateEvent : public QLogEvent {
|
||||
uint64_t pacingBurstSize;
|
||||
std::chrono::microseconds pacingInterval;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogPacingObservationEvent : public QLogEvent {
|
||||
@ -613,7 +613,7 @@ class QLogPacingObservationEvent : public QLogEvent {
|
||||
std::string conclusion;
|
||||
|
||||
~QLogPacingObservationEvent() override = default;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogAppIdleUpdateEvent : public QLogEvent {
|
||||
@ -626,7 +626,7 @@ class QLogAppIdleUpdateEvent : public QLogEvent {
|
||||
std::string idleEvent;
|
||||
bool idle;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogPacketDropEvent : public QLogEvent {
|
||||
@ -639,7 +639,7 @@ class QLogPacketDropEvent : public QLogEvent {
|
||||
size_t packetSize;
|
||||
std::string dropReason;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogDatagramReceivedEvent : public QLogEvent {
|
||||
@ -650,7 +650,7 @@ class QLogDatagramReceivedEvent : public QLogEvent {
|
||||
~QLogDatagramReceivedEvent() override = default;
|
||||
uint64_t dataLen;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogLossAlarmEvent : public QLogEvent {
|
||||
@ -666,7 +666,7 @@ class QLogLossAlarmEvent : public QLogEvent {
|
||||
uint64_t alarmCount;
|
||||
uint64_t outstandingPackets;
|
||||
std::string type;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogPacketsLostEvent : public QLogEvent {
|
||||
@ -680,7 +680,7 @@ class QLogPacketsLostEvent : public QLogEvent {
|
||||
PacketNum largestLostPacketNum;
|
||||
uint64_t lostBytes;
|
||||
uint64_t lostPackets;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogTransportStateUpdateEvent : public QLogEvent {
|
||||
@ -690,7 +690,7 @@ class QLogTransportStateUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTime);
|
||||
~QLogTransportStateUpdateEvent() override = default;
|
||||
std::string update;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogPacketBufferedEvent : public QLogEvent {
|
||||
@ -702,7 +702,7 @@ class QLogPacketBufferedEvent : public QLogEvent {
|
||||
~QLogPacketBufferedEvent() override = default;
|
||||
ProtectionType protectionType;
|
||||
uint64_t packetSize;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogPacketAckEvent : public QLogEvent {
|
||||
@ -714,7 +714,7 @@ class QLogPacketAckEvent : public QLogEvent {
|
||||
~QLogPacketAckEvent() override = default;
|
||||
PacketNumberSpace packetNumSpace;
|
||||
PacketNum packetNum;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogMetricUpdateEvent : public QLogEvent {
|
||||
@ -730,7 +730,7 @@ class QLogMetricUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds mrtt;
|
||||
std::chrono::microseconds srtt;
|
||||
std::chrono::microseconds ackDelay;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
class QLogStreamStateUpdateEvent : public QLogEvent {
|
||||
@ -745,7 +745,7 @@ class QLogStreamStateUpdateEvent : public QLogEvent {
|
||||
StreamId id;
|
||||
std::string update;
|
||||
Optional<std::chrono::milliseconds> timeSinceStreamCreation;
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
private:
|
||||
VantagePoint vantagePoint_;
|
||||
@ -760,7 +760,7 @@ class QLogConnectionMigrationEvent : public QLogEvent {
|
||||
|
||||
~QLogConnectionMigrationEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
bool intentionalMigration_;
|
||||
VantagePoint vantagePoint_;
|
||||
@ -777,7 +777,7 @@ class QLogPathValidationEvent : public QLogEvent {
|
||||
|
||||
~QLogPathValidationEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
bool success_;
|
||||
VantagePoint vantagePoint_;
|
||||
};
|
||||
@ -791,7 +791,7 @@ class QLogPriorityUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogPriorityUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
private:
|
||||
StreamId streamId_;
|
||||
@ -808,7 +808,7 @@ class QLogL4sWeightUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogL4sWeightUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
double l4sWeight_;
|
||||
uint32_t newECT1Echoed_;
|
||||
@ -827,7 +827,7 @@ class QLogNetworkPathModelUpdateEvent : public QLogEvent {
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogNetworkPathModelUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
[[nodiscard]] folly::dynamic toDynamic() const override;
|
||||
|
||||
uint64_t inflightHi_;
|
||||
uint64_t inflightLo_;
|
||||
|
@ -715,7 +715,7 @@ class QuicServerWorker : public FollyAsyncUDPSocketAlias::ReadCallback,
|
||||
/**
|
||||
* Get reference to vector containing observers.
|
||||
*/
|
||||
FOLLY_NODISCARD const std::vector<AcceptObserver*>& getAll() const {
|
||||
[[nodiscard]] const std::vector<AcceptObserver*>& getAll() const {
|
||||
return observers_;
|
||||
}
|
||||
|
||||
|
@ -155,11 +155,11 @@ struct PriorityQueue {
|
||||
bool incremental{false};
|
||||
std::unique_ptr<Iterator> iterator;
|
||||
|
||||
FOLLY_NODISCARD bool empty() const {
|
||||
[[nodiscard]] bool empty() const {
|
||||
return streams.empty();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD OrderedStream getOrderedStream(StreamId id) const {
|
||||
[[nodiscard]] OrderedStream getOrderedStream(StreamId id) const {
|
||||
auto it = streamToOrderId.find(id);
|
||||
if (it == streamToOrderId.end()) {
|
||||
return OrderedStream(id, 0);
|
||||
@ -261,11 +261,11 @@ struct PriorityQueue {
|
||||
}
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD size_t count(StreamId id) const {
|
||||
[[nodiscard]] size_t count(StreamId id) const {
|
||||
return writableStreamsToLevel_.count(id);
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool empty() const {
|
||||
[[nodiscard]] bool empty() const {
|
||||
return writableStreamsToLevel_.empty();
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ struct PriorityQueue {
|
||||
}
|
||||
|
||||
// Only used for testing
|
||||
FOLLY_NODISCARD StreamId getNextScheduledStream(Priority pri) const {
|
||||
[[nodiscard]] StreamId getNextScheduledStream(Priority pri) const {
|
||||
auto& level = levels[priority2index(pri)];
|
||||
if (!level.incremental ||
|
||||
level.iterator->nextStreamIt == level.streams.end()) {
|
||||
@ -297,7 +297,7 @@ struct PriorityQueue {
|
||||
return level.iterator->nextStreamIt->streamId;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD StreamId getNextScheduledStream() const {
|
||||
[[nodiscard]] StreamId getNextScheduledStream() const {
|
||||
const auto& levelIter =
|
||||
std::find_if(levels.cbegin(), levels.cend(), [&](const auto& level) {
|
||||
return !level.empty();
|
||||
|
@ -453,7 +453,7 @@ struct QuicConnectionStateBase : public folly::DelayedDestruction {
|
||||
// Number of probing packets to send after PTO
|
||||
EnumArray<PacketNumberSpace, uint8_t> numProbePackets{};
|
||||
|
||||
FOLLY_NODISCARD bool anyProbePackets() const {
|
||||
[[nodiscard]] bool anyProbePackets() const {
|
||||
return numProbePackets[PacketNumberSpace::Initial] +
|
||||
numProbePackets[PacketNumberSpace::Handshake] +
|
||||
numProbePackets[PacketNumberSpace::AppData];
|
||||
|
@ -538,15 +538,15 @@ struct QuicStreamState : public QuicStreamLike {
|
||||
}
|
||||
|
||||
// Whether this stream has non-DSR data in the write buffer or loss buffer.
|
||||
FOLLY_NODISCARD bool hasSchedulableData() const {
|
||||
[[nodiscard]] bool hasSchedulableData() const {
|
||||
return hasWritableData() || !lossBuffer.empty();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool hasSchedulableDsr() const {
|
||||
[[nodiscard]] bool hasSchedulableDsr() const {
|
||||
return hasWritableBufMeta() || !lossBufMetas.empty();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool hasWritableBufMeta() const {
|
||||
[[nodiscard]] bool hasWritableBufMeta() const {
|
||||
if (writeBufMeta.offset == 0) {
|
||||
return false;
|
||||
}
|
||||
@ -560,7 +560,7 @@ struct QuicStreamState : public QuicStreamLike {
|
||||
return false;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool hasSentFIN() const {
|
||||
[[nodiscard]] bool hasSentFIN() const {
|
||||
if (!finalWriteOffset) {
|
||||
return false;
|
||||
}
|
||||
@ -568,11 +568,11 @@ struct QuicStreamState : public QuicStreamLike {
|
||||
writeBufMeta.offset > *finalWriteOffset;
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD bool hasLoss() const {
|
||||
[[nodiscard]] bool hasLoss() const {
|
||||
return !lossBuffer.empty() || !lossBufMetas.empty();
|
||||
}
|
||||
|
||||
FOLLY_NODISCARD uint64_t nextOffsetToWrite() const {
|
||||
[[nodiscard]] uint64_t nextOffsetToWrite() const {
|
||||
// The stream has never had WriteBufferMetas. Then currentWriteOffset
|
||||
// always points to the next offset we send. This of course relies on the
|
||||
// current contract of DSR: Real data always comes first. This code (and a
|
||||
|
Loading…
x
Reference in New Issue
Block a user