Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | fef73e4 | 2016-03-29 14:15:05 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
| 26 | #include "access-strategy.hpp" |
Junxiao Shi | 00dc914 | 2016-11-21 14:23:12 +0000 | [diff] [blame] | 27 | #include "algorithm.hpp" |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 28 | #include "core/logger.hpp" |
| 29 | |
| 30 | namespace nfd { |
| 31 | namespace fw { |
| 32 | |
| 33 | NFD_LOG_INIT("AccessStrategy"); |
| 34 | |
| 35 | const Name AccessStrategy::STRATEGY_NAME("ndn:/localhost/nfd/strategy/access/%FD%01"); |
Junxiao Shi | faf3eb0 | 2015-02-16 10:50:36 -0700 | [diff] [blame] | 36 | NFD_REGISTER_STRATEGY(AccessStrategy); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 37 | |
| 38 | AccessStrategy::AccessStrategy(Forwarder& forwarder, const Name& name) |
| 39 | : Strategy(forwarder, name) |
| 40 | , m_removeFaceInfoConn(this->beforeRemoveFace.connect( |
| 41 | bind(&AccessStrategy::removeFaceInfo, this, _1))) |
| 42 | { |
| 43 | } |
| 44 | |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 45 | void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 46 | AccessStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest, |
| 47 | const shared_ptr<pit::Entry>& pitEntry) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 48 | { |
Junxiao Shi | a788e25 | 2015-01-28 17:06:25 -0700 | [diff] [blame] | 49 | RetxSuppression::Result suppressResult = m_retxSuppression.decide(inFace, interest, *pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 50 | switch (suppressResult) { |
Junxiao Shi | a788e25 | 2015-01-28 17:06:25 -0700 | [diff] [blame] | 51 | case RetxSuppression::NEW: |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 52 | this->afterReceiveNewInterest(inFace, interest, pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 53 | break; |
Junxiao Shi | a788e25 | 2015-01-28 17:06:25 -0700 | [diff] [blame] | 54 | case RetxSuppression::FORWARD: |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 55 | this->afterReceiveRetxInterest(inFace, interest, pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 56 | break; |
Junxiao Shi | a788e25 | 2015-01-28 17:06:25 -0700 | [diff] [blame] | 57 | case RetxSuppression::SUPPRESS: |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 58 | NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " retx-suppress"); |
| 59 | break; |
| 60 | default: |
| 61 | BOOST_ASSERT(false); |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 67 | AccessStrategy::afterReceiveNewInterest(const Face& inFace, const Interest& interest, |
| 68 | const shared_ptr<pit::Entry>& pitEntry) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 69 | { |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 70 | const fib::Entry& fibEntry = this->lookupFib(*pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 71 | Name miName; |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 72 | MtInfo* mi = nullptr; |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 73 | std::tie(miName, mi) = this->findPrefixMeasurements(*pitEntry); |
| 74 | |
| 75 | // has measurements for Interest Name? |
| 76 | if (mi != nullptr) { |
| 77 | NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << |
| 78 | " new-interest mi=" << miName); |
| 79 | |
| 80 | // send to last working nexthop |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 81 | bool isSentToLastNexthop = this->sendToLastNexthop(inFace, interest, pitEntry, *mi, fibEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 82 | |
| 83 | if (isSentToLastNexthop) { |
| 84 | return; |
| 85 | } |
| 86 | } |
| 87 | else { |
| 88 | NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << |
| 89 | " new-interest no-mi"); |
| 90 | } |
| 91 | |
| 92 | // no measurements, or last working nexthop unavailable |
| 93 | |
Junxiao Shi | 965d3a4 | 2015-06-01 06:55:23 -0700 | [diff] [blame] | 94 | // multicast to all nexthops except incoming face |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 95 | int nMulticastSent = this->multicast(inFace, interest, pitEntry, fibEntry); |
| 96 | |
| 97 | if (nMulticastSent < 1) { |
| 98 | this->rejectPendingInterest(pitEntry); |
| 99 | } |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 103 | AccessStrategy::afterReceiveRetxInterest(const Face& inFace, const Interest& interest, |
| 104 | const shared_ptr<pit::Entry>& pitEntry) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 105 | { |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 106 | const fib::Entry& fibEntry = this->lookupFib(*pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 107 | NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " retx-forward"); |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 108 | this->multicast(inFace, interest, pitEntry, fibEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | bool |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 112 | AccessStrategy::sendToLastNexthop(const Face& inFace, const Interest& interest, |
| 113 | const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi, |
| 114 | const fib::Entry& fibEntry) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 115 | { |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 116 | if (mi.lastNexthop == face::INVALID_FACEID) { |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 117 | NFD_LOG_DEBUG(pitEntry->getInterest() << " no-last-nexthop"); |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | if (mi.lastNexthop == inFace.getId()) { |
| 122 | NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-is-downstream"); |
| 123 | return false; |
| 124 | } |
| 125 | |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 126 | Face* outFace = this->getFace(mi.lastNexthop); |
| 127 | if (outFace == nullptr || !fibEntry.hasNextHop(*outFace)) { |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 128 | NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone"); |
| 129 | return false; |
| 130 | } |
| 131 | |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 132 | if (wouldViolateScope(inFace, interest, *outFace)) { |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 133 | NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-violates-scope"); |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | RttEstimator::Duration rto = mi.rtt.computeRto(); |
| 138 | NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop << |
| 139 | " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count()); |
| 140 | |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 141 | this->sendInterest(pitEntry, *outFace, interest); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 142 | |
| 143 | // schedule RTO timeout |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 144 | PitInfo* pi = pitEntry->insertStrategyInfo<PitInfo>().first; |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 145 | pi->rtoTimer = scheduler::schedule(rto, |
| 146 | bind(&AccessStrategy::afterRtoTimeout, this, weak_ptr<pit::Entry>(pitEntry), |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 147 | inFace.getId(), mi.lastNexthop)); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 148 | |
| 149 | return true; |
| 150 | } |
| 151 | |
| 152 | void |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 153 | AccessStrategy::afterRtoTimeout(weak_ptr<pit::Entry> pitWeak, FaceId inFaceId, FaceId firstOutFaceId) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 154 | { |
| 155 | shared_ptr<pit::Entry> pitEntry = pitWeak.lock(); |
| 156 | BOOST_ASSERT(pitEntry != nullptr); |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 157 | // if pitEntry is gone, RTO timer should have been cancelled |
| 158 | |
| 159 | Face* inFace = this->getFace(inFaceId); |
| 160 | if (inFace == nullptr) { |
| 161 | NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId << |
| 162 | " inFace-gone " << inFaceId); |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(*inFace); |
| 167 | BOOST_ASSERT(inRecord != pitEntry->in_end()); |
| 168 | // in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled |
| 169 | // note: if this strategy is extended to send Nacks, that would also erase in-record, |
| 170 | // and RTO timer should be cancelled in that case as well |
| 171 | |
| 172 | const Interest& interest = inRecord->getInterest(); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 173 | |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 174 | const fib::Entry& fibEntry = this->lookupFib(*pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 175 | |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 176 | NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId << |
| 177 | " multicast-except " << firstOutFaceId); |
| 178 | this->multicast(*inFace, interest, pitEntry, fibEntry, firstOutFaceId); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 181 | int |
| 182 | AccessStrategy::multicast(const Face& inFace, const Interest& interest, |
| 183 | const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry, |
| 184 | FaceId exceptFace) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 185 | { |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 186 | int nSent = 0; |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 187 | for (const fib::NextHop& nexthop : fibEntry.getNextHops()) { |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 188 | Face& outFace = nexthop.getFace(); |
| 189 | if (&outFace == &inFace || outFace.getId() == exceptFace || |
| 190 | wouldViolateScope(inFace, interest, outFace)) { |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 191 | continue; |
| 192 | } |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 193 | NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << outFace.getId() << |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 194 | " multicast"); |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 195 | this->sendInterest(pitEntry, outFace, interest); |
| 196 | ++nSent; |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 197 | } |
Junxiao Shi | a7f9a29 | 2016-11-22 16:31:38 +0000 | [diff] [blame^] | 198 | return nSent; |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 202 | AccessStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry, |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 203 | const Face& inFace, const Data& data) |
| 204 | { |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 205 | PitInfo* pi = pitEntry->getStrategyInfo<PitInfo>(); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 206 | if (pi != nullptr) { |
| 207 | pi->rtoTimer.cancel(); |
| 208 | } |
| 209 | |
Junxiao Shi | 4846f37 | 2016-04-05 13:39:30 -0700 | [diff] [blame] | 210 | if (!pitEntry->hasInRecords()) { // already satisfied by another upstream |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 211 | NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() << |
| 212 | " not-fastest"); |
| 213 | return; |
| 214 | } |
| 215 | |
Junxiao Shi | 4846f37 | 2016-04-05 13:39:30 -0700 | [diff] [blame] | 216 | pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace); |
| 217 | if (outRecord == pitEntry->out_end()) { // no out-record |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 218 | NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() << |
| 219 | " no-out-record"); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | time::steady_clock::Duration rtt = time::steady_clock::now() - outRecord->getLastRenewed(); |
| 224 | NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() << |
| 225 | " rtt=" << time::duration_cast<time::microseconds>(rtt).count()); |
| 226 | this->updateMeasurements(inFace, data, time::duration_cast<RttEstimator::Duration>(rtt)); |
| 227 | } |
| 228 | |
| 229 | void |
| 230 | AccessStrategy::updateMeasurements(const Face& inFace, const Data& data, |
| 231 | const RttEstimator::Duration& rtt) |
| 232 | { |
| 233 | FaceInfo& fi = m_fit[inFace.getId()]; |
| 234 | fi.rtt.addMeasurement(rtt); |
| 235 | |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 236 | MtInfo* mi = this->addPrefixMeasurements(data); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 237 | if (mi->lastNexthop != inFace.getId()) { |
| 238 | mi->lastNexthop = inFace.getId(); |
| 239 | mi->rtt = fi.rtt; |
| 240 | } |
| 241 | else { |
| 242 | mi->rtt.addMeasurement(rtt); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | AccessStrategy::MtInfo::MtInfo() |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 247 | : lastNexthop(face::INVALID_FACEID) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 248 | , rtt(1, time::milliseconds(1), 0.1) |
| 249 | { |
| 250 | } |
| 251 | |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 252 | std::tuple<Name, AccessStrategy::MtInfo*> |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 253 | AccessStrategy::findPrefixMeasurements(const pit::Entry& pitEntry) |
| 254 | { |
Junxiao Shi | 80f9fcd | 2016-07-23 02:48:36 +0000 | [diff] [blame] | 255 | measurements::Entry* me = this->getMeasurements().findLongestPrefixMatch(pitEntry); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 256 | if (me == nullptr) { |
Junxiao Shi | 5b3feb6 | 2016-08-19 01:51:41 +0000 | [diff] [blame] | 257 | return std::make_tuple(Name(), nullptr); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 258 | } |
| 259 | |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 260 | MtInfo* mi = me->getStrategyInfo<MtInfo>(); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 261 | BOOST_ASSERT(mi != nullptr); |
| 262 | // XXX after runtime strategy change, it's possible that me exists but mi doesn't exist; |
| 263 | // this case needs another longest prefix match until mi is found |
Junxiao Shi | 5b3feb6 | 2016-08-19 01:51:41 +0000 | [diff] [blame] | 264 | return std::make_tuple(me->getName(), mi); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 265 | } |
| 266 | |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 267 | AccessStrategy::MtInfo* |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 268 | AccessStrategy::addPrefixMeasurements(const Data& data) |
| 269 | { |
Junxiao Shi | 80f9fcd | 2016-07-23 02:48:36 +0000 | [diff] [blame] | 270 | measurements::Entry* me = nullptr; |
| 271 | if (!data.getName().empty()) { |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 272 | me = this->getMeasurements().get(data.getName().getPrefix(-1)); |
| 273 | } |
| 274 | if (me == nullptr) { // parent of Data Name is not in this strategy, or Data Name is empty |
| 275 | me = this->getMeasurements().get(data.getName()); |
| 276 | // Data Name must be in this strategy |
| 277 | BOOST_ASSERT(me != nullptr); |
| 278 | } |
| 279 | |
Junxiao Shi | 7b0f4d1 | 2015-05-10 21:40:29 -0700 | [diff] [blame] | 280 | static const time::nanoseconds ME_LIFETIME = time::seconds(8); |
| 281 | this->getMeasurements().extendLifetime(*me, ME_LIFETIME); |
| 282 | |
Junxiao Shi | fc02186 | 2016-08-25 21:51:18 +0000 | [diff] [blame] | 283 | return me->insertStrategyInfo<MtInfo>().first; |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | AccessStrategy::FaceInfo::FaceInfo() |
| 287 | : rtt(1, time::milliseconds(1), 0.1) |
| 288 | { |
| 289 | } |
| 290 | |
| 291 | void |
Junxiao Shi | ae04d34 | 2016-07-19 13:20:22 +0000 | [diff] [blame] | 292 | AccessStrategy::removeFaceInfo(const Face& face) |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 293 | { |
Junxiao Shi | ae04d34 | 2016-07-19 13:20:22 +0000 | [diff] [blame] | 294 | m_fit.erase(face.getId()); |
Junxiao Shi | 80ee7cb | 2014-12-14 10:53:05 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | } // namespace fw |
| 298 | } // namespace nfd |