Actions
Bug #1298
closedInterest with implicit digest component cannot be satisfied
Start date:
Due date:
% Done:
100%
Estimated time:
2.00 h
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
}
Updated by Junxiao Shi over 10 years ago
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.
Updated by Alex Afanasyev over 10 years ago
- Category set to Base
- Assignee set to Alex Afanasyev
- Target version set to v0.2
- Estimated time set to 2.00 h
Updated by Alex Afanasyev over 10 years ago
- Status changed from New to Code review
- % Done changed from 0 to 100
Updated by Alex Afanasyev over 10 years ago
- Status changed from Code review to Closed
Actions