// *************************************************************** void osLoopClass::timerTick() { //Determine which loops to run //if (++u32_timerTick_10mS >=1000) { // u32_timerTick_10mS=0; //Serial.println("\n\r ****timerTick 10seconds"); //} if (true==schedulerState) { for(uint8_t lpId=0;lpId <maxNum_id;lpId++) {//Loop through id if (0!=loopQue[lpId].qCntr_10mS) { //0 if no action if (1==loopQue[lpId].qCntr_10mS--){//1 timer is fired scheduleLoop(lpId);//activate now //if stored copy != 1 then start timer again uint8_t timerCnt= (pManage+lpId)->timer_cnt; if (0!=timerCnt){ loopQue[lpId].qCntr_10mS=timerCnt+1; //reschedule } } } } } }//timerTick
void Fib::update(const ndn::Name& name, NexthopList& allHops) { NLSR_LOG_DEBUG("Fib::update called"); // Get the max possible faces which is the minumum of the configuration setting and // the length of the list of all next hops. unsigned int maxFaces = getNumberOfFacesForName(allHops); NexthopList hopsToAdd; unsigned int nFaces = 0; // Create a list of next hops to be installed with length == maxFaces for (NexthopList::iterator it = allHops.begin(); it != allHops.end() && nFaces < maxFaces; ++it, ++nFaces) { hopsToAdd.addNextHop(*it); } std::map<ndn::Name, FibEntry>::iterator entryIt = m_table.find(name); // New FIB entry that has nextHops if (entryIt == m_table.end() && hopsToAdd.size() != 0) { NLSR_LOG_DEBUG("New FIB Entry"); FibEntry entry(name); addNextHopsToFibEntryAndNfd(entry, hopsToAdd); m_table.emplace(name, entry); entryIt = m_table.find(name); } // Existing FIB entry that may or may not have nextHops else { // Existing FIB entry NLSR_LOG_DEBUG("Existing FIB Entry"); // Remove empty FIB entry if (hopsToAdd.size() == 0) { remove(name); return; } FibEntry& entry = (entryIt->second); addNextHopsToFibEntryAndNfd(entry, hopsToAdd); std::set<NextHop, NextHopComparator> hopsToRemove; std::set_difference(entry.getNexthopList().begin(), entry.getNexthopList().end(), hopsToAdd.begin(), hopsToAdd.end(), std::inserter(hopsToRemove, hopsToRemove.end()), NextHopComparator()); bool isUpdatable = isPrefixUpdatable(entry.getName()); // Remove the uninstalled next hops from NFD and FIB entry for (const auto& hop: hopsToRemove){ if (isUpdatable) { unregisterPrefix(entry.getName(), hop.getConnectingFaceUri()); } NLSR_LOG_DEBUG("Removing " << hop.getConnectingFaceUri() << " from " << entry.getName()); entry.getNexthopList().removeNextHop(hop); } // Increment sequence number entry.setSeqNo(entry.getSeqNo() + 1); entryIt = m_table.find(name); } if (entryIt != m_table.end() && !entryIt->second.getRefreshEventId()) { scheduleEntryRefresh(entryIt->second, [this] (FibEntry& entry) { scheduleLoop(entry); }); } }
// *************************************************************** inline bool osLoopClass::scheduleLoop( uint8_t my_id) { return scheduleLoop(my_id,0); }