Example #1
0
void
HelloProtocol::onRegistrationFailure(const ndn::nfd::ControlResponse& response,
                                     const ndn::Name& name)
{
  _LOG_DEBUG(response.getText() << " (code: " << response.getCode() << ")");
  /*
  * If NLSR can not create face for given faceUri then it will treat this
  * failure as one INFO interest timed out. So that NLSR can move on with
  * building Adj Lsa and calculate routing table. NLSR does not build Adj
  * Lsa unless all the neighbors are ACTIVE or DEAD. For considering the
  * missconfigured(link) neighbour dead this is required.
  */
  Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(name);
  if (adjacent != 0) {
    adjacent->setInterestTimedOutNo(adjacent->getInterestTimedOutNo() + 1);
    Adjacent::Status status = adjacent->getStatus();
    uint32_t infoIntTimedOutCount = adjacent->getInterestTimedOutNo();

    if (infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber()) {
      if (status == Adjacent::STATUS_ACTIVE) {
        adjacent->setStatus(Adjacent::STATUS_INACTIVE);
      }

      m_nlsr.getLsdb().scheduleAdjLsaBuild();
    }
  }
}