Exemplo n.º 1
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());
}
Exemplo n.º 2
0
bool
OutRecord::setIncomingNack(const lp::Nack& nack)
{
  if (nack.getInterest().getNonce() != this->getLastNonce()) {
    return false;
  }

  m_incomingNack.reset(new lp::NackHeader(nack.getHeader()));
  return true;
}
Exemplo n.º 3
0
void
GenericLinkService::doSendNack(const lp::Nack& nack, const EndpointId& endpointId)
{
  lp::Packet lpPacket(nack.getInterest().wireEncode());
  lpPacket.add<lp::NackField>(nack.getHeader());

  encodeLpFields(nack, lpPacket);

  this->sendNetPacket(std::move(lpPacket), endpointId, false);
}
Exemplo n.º 4
0
void
DummyClientFace::receive(const lp::Nack& nack)
{
  lp::Packet lpPacket;
  lpPacket.add<lp::NackField>(nack.getHeader());
  Block interest = nack.getInterest().wireEncode();
  lpPacket.add<lp::FragmentField>(make_pair(interest.begin(), interest.end()));

  addFieldFromTag<lp::IncomingFaceIdField, lp::IncomingFaceIdTag>(lpPacket, nack);
  addFieldFromTag<lp::CongestionMarkField, lp::CongestionMarkTag>(lpPacket, nack);

  static_pointer_cast<Transport>(getTransport())->receive(lpPacket.wireEncode());
}
Exemplo n.º 5
0
 void
 nackPendingInterests(const lp::Nack& nack)
 {
   for (auto entry = m_pendingInterestTable.begin(); entry != m_pendingInterestTable.end(); ) {
     const Interest& pendingInterest = *(*entry)->getInterest();
     if (nack.getInterest().matchesInterest(pendingInterest)) {
       shared_ptr<PendingInterest> matchedEntry = *entry;
       entry = m_pendingInterestTable.erase(entry);
       matchedEntry->invokeNackCallback(nack);
     }
     else {
       ++entry;
     }
   }
 }
Exemplo n.º 6
0
void
DummyClientFace::receive<lp::Nack>(const lp::Nack& nack)
{
  lp::Packet lpPacket;
  lpPacket.add<lp::NackField>(nack.getHeader());
  Block interest = nack.getInterest().wireEncode();
  lpPacket.add<lp::FragmentField>(make_pair(interest.begin(), interest.end()));

  nfd::LocalControlHeader localControlHeader = nack.getLocalControlHeader();

  if (localControlHeader.hasIncomingFaceId()) {
    lpPacket.add<lp::IncomingFaceIdField>(localControlHeader.getIncomingFaceId());
  }

  m_transport->receive(lpPacket.wireEncode());
}
  time::milliseconds
  exponentialBackoff(lp::Nack nack)
  {
    uint64_t nackSequenceNo;

    try {
      nackSequenceNo = nack.getInterest().getName().get(-1).toSequenceNumber();
    }
    catch (name::Component::Error&) {
      nackSequenceNo = 0;
    }

    if (m_lastNackSequenceNo ==  nackSequenceNo) {
      ++m_attempts;
    } else {
      m_attempts = 1;
    }

    time::milliseconds delayTime =
      time::milliseconds (static_cast<uint32_t>( pow(2, m_attempts) * 100 + random::generateWord32() % 100));

    m_lastNackSequenceNo = nackSequenceNo;
    return delayTime;
  }