Project

General

Profile

Actions

Bug #1298

closed

Interest with implicit digest component cannot be satisfied

Added by Junxiao Shi almost 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
2.00 h

Description

Steps to reproduce:

  1. Send an Interest with implicit digest as its last NameComponent
  2. 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
}
Actions #1

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.

Actions #2

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
Actions #3

Updated by Alex Afanasyev over 10 years ago

  • Status changed from New to Code review
  • % Done changed from 0 to 100
Actions #4

Updated by Alex Afanasyev over 10 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF