table: pit::Entry checks Interest matches entry when updating in/out-record
pit::Entry::canMatch is the single place to determine whether an Interest
matches an Interest table entry. This condition is asserted when an in/out-
record is inserted or updated. This prevents a strategy from incorrectly
picking an Interest that is incompatible with the Interest table entry.
refs #1756
Change-Id: Ibf61a0e2e32b7a0e04e581f01ef07b791c6010a2
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 8fc78bf..3256b89 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -64,14 +64,10 @@
size_t nteNameLen = nteName.size();
const std::vector<shared_ptr<Entry>>& pitEntries = nte->getPitEntries();
auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
- [&interest, nteNameLen] (const shared_ptr<Entry>& entry) -> bool {
- // initial part of the name is guaranteed to be the same
- BOOST_ASSERT(entry->getInterest().getName().compare(0, nteNameLen,
- interest.getName(), 0, nteNameLen) == 0);
- // compare implicit digest (or its absence) only
- return entry->getInterest().getName().compare(nteNameLen, Name::npos,
- interest.getName(), nteNameLen) == 0 &&
- entry->getInterest().getSelectors() == interest.getSelectors();
+ [&interest, nteNameLen] (const shared_ptr<Entry>& entry) {
+ // initial part of name is guaranteed to be equal by NameTree
+ // check implicit digest (or its absence) only
+ return entry->canMatch(interest, nteNameLen);
});
if (it != pitEntries.end()) {
return {*it, false};