Bug #1298
closed
Interest with implicit digest component cannot be satisfied
Added by Junxiao Shi over 10 years ago.
Updated over 10 years ago.
Description
Steps to reproduce:
- Send an Interest with implicit digest as its last NameComponent
- Producer answers with a Data that can match this Interest
Expected: OnData callback is invoked
Actual: OnData callback is not invoked
Relevant snippets:
Face::onReceiveElement {
getEntryIndexForExpressedInterest(data->getName()); // implicit digest is not computed
}
Face::getEntryIndexForExpressedInterest {
getInterest()->matchesName(name) // Interest may contain implicit digest and be one component longer than Data Name
}
I propose fixing this bug with the following pseudocode:
bool canSatisfy(const Interest& interest, const Data& data)
{
Name fullName(data.getName());
fullName.append(data.computeDigest());
if (!interest.getName().isPrefixOf(fullName))
return false;
size_t nSuffixComponents = fullName.size() - interest.getName().size();
if (interest->hasMinSuffixComponents() &&
nSuffixComponents < interest->getMinSuffixComponents())
return false;
if (interest->hasMaxSuffixComponents() &&
nSuffixComponents > interest->getMaxSuffixComponents())
return false;
if (interest->hasExclude()) {
if (fullName.size() == interest->getName().size())
return false;
Name::Component nextComponent = fullName.at(interest.getName().size());
if (interest->getExclude()->isExcluded(nextComponent))
return false;
}
if (interest->hasPublisherPublicKeyLocator() &&
(!data->hasKeyLocator() ||
data->getKeyLocator() != interest->getPublisherPublicKeyLocator()))
return false;
return true;
}
To reduce the overhead of Data::computeDigest
, its result will be cached in Data class.
- Category set to Base
- Assignee set to Alex Afanasyev
- Target version set to v0.2
- Estimated time set to 2.00 h
- Status changed from New to Code review
- % Done changed from 0 to 100
- Status changed from Code review to Closed
Also available in: Atom
PDF