fw: ASF: Fix implementation not matching technical report
This commit resolves several issues. First, a bug was discovered
regarding the usage of std::set objects when ranking faces for
forwarding and probing purposes. These objects enforce uniqueness;
however, this is defined based on the comparison function provided.
As no fields that were inherently unique were used to rank faces, this
would mean that a face with matching ranking information as one
inserted previously would be blocked from being inserted into face
ranking for forwarding and probing. We add faceId as a tiebreaker to
ensure deterministic behavior in these cases. We also fix an issue
where the count of consecutive silent timeouts was not properly cleared
upon the receipt of data or when a timeout was marked.
Additionally, this commit replaces previous implementations of the
ranking code for forwarding and probing. This is partially in order
to eliminate bugs introduced by incorrect implementations of the ranking
for probing and forwarding, as well as trying to make the code easier
to understand and maintain. This included removing a specific
optimization in probing by including unmeasured faces in the
ranking rather than have probes to unmeasured faces be ordered
based on undefined metrics (in practice, tied faces were inserted
in route creation order). However, we did make the choice to add
cost as a tiebreaker for working measured faces, as was the case
with the initial implementation for forwarding.
Refs #5310
Change-Id: Iabfdafea764fe24fe6c478a6073734e51aaf9fa1
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index 4607d4e..83bff13 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -86,11 +86,18 @@
sendNoRouteNack(Face& face, const shared_ptr<pit::Entry>& pitEntry);
private:
- AsfMeasurements m_measurements;
+ AsfMeasurements m_measurements{getMeasurements()};
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ struct FaceStatsForwardingCompare
+ {
+ bool
+ operator()(const FaceStats& lhs, const FaceStats& rhs) const noexcept;
+ };
+ using FaceStatsForwardingSet = std::set<FaceStats, FaceStatsForwardingCompare>;
+
std::unique_ptr<RetxSuppressionExponential> m_retxSuppression;
- ProbingModule m_probing;
+ ProbingModule m_probing{m_measurements};
size_t m_nMaxTimeouts = 3;
friend ProcessNackTraits<AsfStrategy>;