void
PipelineInterests::handleNack(const Interest& interest, const lp::Nack& nack)
{
  if (m_options.isVerbose)
    std::cerr << "Received Nack with reason " << nack.getReason()
              << " for Interest " << interest << std::endl;

  switch (nack.getReason()) {
  case lp::NackReason::DUPLICATE: {
    break; // ignore duplicates
  }
  case lp::NackReason::CONGESTION: { // treated the same as timeout for now
    uint64_t segno = interest.getName()[-1].toSegment();
    m_segmentInfoMap[segno]->state = inRetxQueue; // update state
    handleTimeout(1);
    break;
  }
  default: {
    m_hasError = true;
    fail("Could not retrieve data for " + interest.getName().toUri() +
         ", reason: " + boost::lexical_cast<std::string>(nack.getReason()));
    break;
  }
  }
}
void
CertificateFetcherFromNetwork::nackCallback(const lp::Nack& nack,
                                            const shared_ptr<CertificateRequest>& certRequest,
                                            const shared_ptr<ValidationState>& state,
                                            const ValidationContinuation& continueValidation)
{
  NDN_LOG_DEBUG_DEPTH("NACK (" << nack.getReason() <<  ") while fetching certificate "
                      << certRequest->interest.getName());

  --certRequest->nRetriesLeft;
  if (certRequest->nRetriesLeft >= 0) {
    m_scheduler.schedule(certRequest->waitAfterNack,
                         [=] { fetch(certRequest, state, continueValidation); });
    certRequest->waitAfterNack *= 2;
  }
  else {
    state->fail({ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate after all "
                 "retries `" + certRequest->interest.getName().toUri() + "`"});
  }
}
예제 #3
0
void
SegmentFetcher::afterNackReceivedCb(const Interest& origInterest, const lp::Nack& nack,
                                    const weak_ptr<SegmentFetcher>& weakSelf)
{
  if (shouldStop(weakSelf))
    return;

  afterSegmentNacked();

  BOOST_ASSERT(m_nSegmentsInFlight > 0);
  m_nSegmentsInFlight--;

  switch (nack.getReason()) {
    case lp::NackReason::DUPLICATE:
    case lp::NackReason::CONGESTION:
      afterNackOrTimeout(origInterest);
      break;
    default:
      signalError(NACK_ERROR, "Nack Error");
      break;
  }
}
예제 #4
0
void
AsfStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
                              const shared_ptr<pit::Entry>& pitEntry)
{
  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << inFace.getId() << ": " << nack.getReason());
  onTimeout(pitEntry->getName(), inFace.getId());
}