mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-04-18 17:24:03 +03:00
Summary: The logic for deciding which ACK type to write was duplicated in QuicPacketScheduler and QuicPacketRebuilder. This refactors the logic out into a separate QuicAckScheduler so it can be tested for correction and reused in both places. Reviewed By: sharmafb Differential Revision: D69933311 fbshipit-source-id: e4f45688a5d258dd2a57f9f7844407f3efad5f49
40 lines
938 B
C++
40 lines
938 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <quic/QuicConstants.h>
|
|
#include <quic/state/StateData.h>
|
|
|
|
namespace quic {
|
|
|
|
class AckScheduler {
|
|
public:
|
|
AckScheduler(const QuicConnectionStateBase& conn, const AckState& ackState);
|
|
|
|
Optional<PacketNum> writeNextAcks(PacketBuilderInterface& builder);
|
|
|
|
[[nodiscard]] bool hasPendingAcks() const;
|
|
|
|
private:
|
|
const QuicConnectionStateBase& conn_;
|
|
const AckState& ackState_;
|
|
};
|
|
|
|
/**
|
|
* Returns whether or not the Ack scheduler has acks to schedule. This does not
|
|
* tell you when the ACKs can be written.
|
|
*/
|
|
bool hasAcksToSchedule(const AckState& ackState);
|
|
|
|
/**
|
|
* Returns the largest packet received which needs to be acked.
|
|
*/
|
|
Optional<PacketNum> largestAckToSend(const AckState& ackState);
|
|
|
|
} // namespace quic
|