blob: d3fb5412fb71ad5afade7c19bb1060bbc6b6f4d1 [file] [log] [blame]
Alexander Afanasyev33b72772014-01-26 23:22:58 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Junxiao Shiaf6569a2014-06-14 00:01:34 -07003 * Copyright (c) 2014, Regents of the University of California,
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
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
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/>.
Junxiao Shiaf6569a2014-06-14 00:01:34 -070024 */
Alexander Afanasyev33b72772014-01-26 23:22:58 -080025
26#include "forwarder.hpp"
Steve DiBenedettobf6a93d2014-03-21 14:03:02 -060027#include "core/logger.hpp"
Junxiao Shiaf6569a2014-06-14 00:01:34 -070028#include "core/random.hpp"
Junxiao Shid938a6b2014-05-11 23:40:29 -070029#include "available-strategies.hpp"
Junxiao Shiaf6569a2014-06-14 00:01:34 -070030#include <boost/random/uniform_int_distribution.hpp>
Alexander Afanasyev33b72772014-01-26 23:22:58 -080031
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080032namespace nfd {
Alexander Afanasyev33b72772014-01-26 23:22:58 -080033
Junxiao Shi8c8d2182014-01-30 22:33:00 -070034NFD_LOG_INIT("Forwarder");
35
Junxiao Shif3c07812014-03-11 21:48:49 -070036using fw::Strategy;
37
Junxiao Shif3c07812014-03-11 21:48:49 -070038const Name Forwarder::LOCALHOST_NAME("ndn:/localhost");
Junxiao Shi88884492014-02-15 15:57:43 -070039
Junxiao Shic041ca32014-02-25 20:01:15 -070040Forwarder::Forwarder()
Junxiao Shia4f2be82014-03-02 22:56:41 -070041 : m_faceTable(*this)
HangZhangad4afd12014-03-01 11:03:08 +080042 , m_fib(m_nameTree)
Haowei Yuan78c84d12014-02-27 15:35:13 -060043 , m_pit(m_nameTree)
HangZhangc85a23c2014-03-01 15:55:55 +080044 , m_measurements(m_nameTree)
Junxiao Shif3c07812014-03-11 21:48:49 -070045 , m_strategyChoice(m_nameTree, fw::makeDefaultStrategy(*this))
Alexander Afanasyev33b72772014-01-26 23:22:58 -080046{
Junxiao Shif3c07812014-03-11 21:48:49 -070047 fw::installStrategies(*this);
Alexander Afanasyev33b72772014-01-26 23:22:58 -080048}
49
Steve DiBenedettobf6a93d2014-03-21 14:03:02 -060050Forwarder::~Forwarder()
51{
52
53}
54
Alexander Afanasyev33b72772014-01-26 23:22:58 -080055void
Junxiao Shid3c792f2014-01-30 00:46:13 -070056Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
57{
58 // receive Interest
Junxiao Shif3c07812014-03-11 21:48:49 -070059 NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
60 " interest=" << interest.getName());
Junxiao Shi06887ac2014-02-13 20:15:42 -070061 const_cast<Interest&>(interest).setIncomingFaceId(inFace.getId());
Junxiao Shi33152f12014-07-16 19:54:32 -070062 ++m_counters.getNInInterests();
Junxiao Shic041ca32014-02-25 20:01:15 -070063
Junxiao Shi88884492014-02-15 15:57:43 -070064 // /localhost scope control
Junxiao Shif3c07812014-03-11 21:48:49 -070065 bool isViolatingLocalhost = !inFace.isLocal() &&
66 LOCALHOST_NAME.isPrefixOf(interest.getName());
67 if (isViolatingLocalhost) {
68 NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
69 " interest=" << interest.getName() << " violates /localhost");
70 // (drop)
Junxiao Shi88884492014-02-15 15:57:43 -070071 return;
72 }
Junxiao Shic041ca32014-02-25 20:01:15 -070073
Junxiao Shid3c792f2014-01-30 00:46:13 -070074 // PIT insert
Junxiao Shi40631842014-03-01 13:52:37 -070075 shared_ptr<pit::Entry> pitEntry = m_pit.insert(interest).first;
Junxiao Shic041ca32014-02-25 20:01:15 -070076
Junxiao Shid3c792f2014-01-30 00:46:13 -070077 // detect loop and record Nonce
78 bool isLoop = ! pitEntry->addNonce(interest.getNonce());
79 if (isLoop) {
80 // goto Interest loop pipeline
81 this->onInterestLoop(inFace, interest, pitEntry);
82 return;
83 }
Junxiao Shic041ca32014-02-25 20:01:15 -070084
Junxiao Shid3c792f2014-01-30 00:46:13 -070085 // cancel unsatisfy & straggler timer
86 this->cancelUnsatisfyAndStragglerTimer(pitEntry);
Junxiao Shic041ca32014-02-25 20:01:15 -070087
Junxiao Shif3c07812014-03-11 21:48:49 -070088 // is pending?
Junxiao Shid3c792f2014-01-30 00:46:13 -070089 const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
Junxiao Shie17349a2014-03-25 00:55:38 -070090 bool isPending = inRecords.begin() != inRecords.end();
Junxiao Shid3c792f2014-01-30 00:46:13 -070091 if (!isPending) {
92 // CS lookup
93 const Data* csMatch = m_cs.find(interest);
94 if (csMatch != 0) {
Junxiao Shi7b984c62014-07-17 22:18:34 -070095 const_cast<Data*>(csMatch)->setIncomingFaceId(FACEID_CONTENT_STORE);
Junxiao Shid3c792f2014-01-30 00:46:13 -070096 // XXX should we lookup PIT for other Interests that also match csMatch?
97
98 // goto outgoing Data pipeline
99 this->onOutgoingData(*csMatch, inFace);
100 return;
101 }
102 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700103
Junxiao Shid3c792f2014-01-30 00:46:13 -0700104 // insert InRecord
Junxiao Shi9b27bd22014-02-26 20:29:58 -0700105 pitEntry->insertOrUpdateInRecord(inFace.shared_from_this(), interest);
Junxiao Shic041ca32014-02-25 20:01:15 -0700106
Alexander Afanasyeva57f8b42014-07-10 20:11:32 -0700107 // set PIT unsatisfy timer
108 this->setUnsatisfyTimer(pitEntry);
109
Junxiao Shid3c792f2014-01-30 00:46:13 -0700110 // FIB lookup
Junxiao Shi40631842014-03-01 13:52:37 -0700111 shared_ptr<fib::Entry> fibEntry = m_fib.findLongestPrefixMatch(*pitEntry);
Junxiao Shic041ca32014-02-25 20:01:15 -0700112
Junxiao Shid3c792f2014-01-30 00:46:13 -0700113 // dispatch to strategy
Junxiao Shif3c07812014-03-11 21:48:49 -0700114 this->dispatchToStrategy(pitEntry, bind(&Strategy::afterReceiveInterest, _1,
Alexander Afanasyevf6980282014-05-13 18:28:40 -0700115 cref(inFace), cref(interest), fibEntry, pitEntry));
Junxiao Shid3c792f2014-01-30 00:46:13 -0700116}
117
118void
119Forwarder::onInterestLoop(Face& inFace, const Interest& interest,
120 shared_ptr<pit::Entry> pitEntry)
121{
Junxiao Shif3c07812014-03-11 21:48:49 -0700122 NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
123 " interest=" << interest.getName());
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700124
Junxiao Shif3c07812014-03-11 21:48:49 -0700125 // (drop)
126}
127
128/** \brief compare two InRecords for picking outgoing Interest
129 * \return true if b is preferred over a
130 *
131 * This function should be passed to std::max_element over InRecordCollection.
132 * The outgoing Interest picked is the last incoming Interest
133 * that does not come from outFace.
134 * If all InRecords come from outFace, it's fine to pick that. This happens when
135 * there's only one InRecord that comes from outFace. The legit use is for
136 * vehicular network; otherwise, strategy shouldn't send to the sole inFace.
137 */
138static inline bool
139compare_pickInterest(const pit::InRecord& a, const pit::InRecord& b, const Face* outFace)
140{
141 bool isOutFaceA = a.getFace().get() == outFace;
142 bool isOutFaceB = b.getFace().get() == outFace;
143
144 if (!isOutFaceA && isOutFaceB) {
145 return false;
146 }
147 if (isOutFaceA && !isOutFaceB) {
148 return true;
149 }
150
151 return a.getLastRenewed() > b.getLastRenewed();
Junxiao Shid3c792f2014-01-30 00:46:13 -0700152}
153
154void
Junxiao Shid938a6b2014-05-11 23:40:29 -0700155Forwarder::onOutgoingInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace,
156 bool wantNewNonce)
Junxiao Shid3c792f2014-01-30 00:46:13 -0700157{
Junxiao Shi223271b2014-07-03 22:06:13 -0700158 if (outFace.getId() == INVALID_FACEID) {
159 NFD_LOG_WARN("onOutgoingInterest face=invalid interest=" << pitEntry->getName());
160 return;
161 }
Junxiao Shif3c07812014-03-11 21:48:49 -0700162 NFD_LOG_DEBUG("onOutgoingInterest face=" << outFace.getId() <<
163 " interest=" << pitEntry->getName());
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700164
Junxiao Shi57f0f312014-03-16 11:52:20 -0700165 // scope control
166 if (pitEntry->violatesScope(outFace)) {
Junxiao Shif3c07812014-03-11 21:48:49 -0700167 NFD_LOG_DEBUG("onOutgoingInterest face=" << outFace.getId() <<
Junxiao Shi57f0f312014-03-16 11:52:20 -0700168 " interest=" << pitEntry->getName() << " violates scope");
Junxiao Shi11bd9c22014-03-13 20:44:13 -0700169 return;
170 }
171
Junxiao Shid3c792f2014-01-30 00:46:13 -0700172 // pick Interest
Junxiao Shif3c07812014-03-11 21:48:49 -0700173 const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
174 pit::InRecordCollection::const_iterator pickedInRecord = std::max_element(
175 inRecords.begin(), inRecords.end(), bind(&compare_pickInterest, _1, _2, &outFace));
176 BOOST_ASSERT(pickedInRecord != inRecords.end());
Junxiao Shid938a6b2014-05-11 23:40:29 -0700177 shared_ptr<Interest> interest = const_pointer_cast<Interest>(
178 pickedInRecord->getInterest().shared_from_this());
179
180 if (wantNewNonce) {
181 interest = make_shared<Interest>(*interest);
Junxiao Shiaf6569a2014-06-14 00:01:34 -0700182 static boost::random::uniform_int_distribution<uint32_t> dist;
183 interest->setNonce(dist(getGlobalRng()));
Junxiao Shid938a6b2014-05-11 23:40:29 -0700184 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700185
Junxiao Shid3c792f2014-01-30 00:46:13 -0700186 // insert OutRecord
Junxiao Shid938a6b2014-05-11 23:40:29 -0700187 pitEntry->insertOrUpdateOutRecord(outFace.shared_from_this(), *interest);
Junxiao Shic041ca32014-02-25 20:01:15 -0700188
Junxiao Shid3c792f2014-01-30 00:46:13 -0700189 // send Interest
Junxiao Shid938a6b2014-05-11 23:40:29 -0700190 outFace.sendInterest(*interest);
Junxiao Shi33152f12014-07-16 19:54:32 -0700191 ++m_counters.getNOutInterests();
Junxiao Shid3c792f2014-01-30 00:46:13 -0700192}
193
194void
Junxiao Shi09498f02014-02-26 19:41:08 -0700195Forwarder::onInterestReject(shared_ptr<pit::Entry> pitEntry)
Junxiao Shid3c792f2014-01-30 00:46:13 -0700196{
Junxiao Shid938a6b2014-05-11 23:40:29 -0700197 if (pitEntry->hasUnexpiredOutRecords()) {
198 NFD_LOG_ERROR("onInterestReject interest=" << pitEntry->getName() <<
199 " cannot reject forwarded Interest");
200 return;
201 }
Junxiao Shi09498f02014-02-26 19:41:08 -0700202 NFD_LOG_DEBUG("onInterestReject interest=" << pitEntry->getName());
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700203
Alexander Afanasyeva57f8b42014-07-10 20:11:32 -0700204 // cancel unsatisfy & straggler timer
205 this->cancelUnsatisfyAndStragglerTimer(pitEntry);
206
Junxiao Shid3c792f2014-01-30 00:46:13 -0700207 // set PIT straggler timer
208 this->setStragglerTimer(pitEntry);
209}
210
211void
212Forwarder::onInterestUnsatisfied(shared_ptr<pit::Entry> pitEntry)
213{
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700214 NFD_LOG_DEBUG("onInterestUnsatisfied interest=" << pitEntry->getName());
215
Junxiao Shid3c792f2014-01-30 00:46:13 -0700216 // invoke PIT unsatisfied callback
Junxiao Shif3c07812014-03-11 21:48:49 -0700217 this->dispatchToStrategy(pitEntry, bind(&Strategy::beforeExpirePendingInterest, _1,
Alexander Afanasyevf6980282014-05-13 18:28:40 -0700218 pitEntry));
Junxiao Shic041ca32014-02-25 20:01:15 -0700219
Junxiao Shif3c07812014-03-11 21:48:49 -0700220 // PIT delete
Junxiao Shid938a6b2014-05-11 23:40:29 -0700221 this->cancelUnsatisfyAndStragglerTimer(pitEntry);
Haowei Yuan78c84d12014-02-27 15:35:13 -0600222 m_pit.erase(pitEntry);
Junxiao Shid3c792f2014-01-30 00:46:13 -0700223}
224
225void
226Forwarder::onIncomingData(Face& inFace, const Data& data)
227{
228 // receive Data
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700229 NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
Junxiao Shi06887ac2014-02-13 20:15:42 -0700230 const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
Junxiao Shi33152f12014-07-16 19:54:32 -0700231 ++m_counters.getNInDatas();
Junxiao Shic041ca32014-02-25 20:01:15 -0700232
Junxiao Shi88884492014-02-15 15:57:43 -0700233 // /localhost scope control
Junxiao Shif3c07812014-03-11 21:48:49 -0700234 bool isViolatingLocalhost = !inFace.isLocal() &&
235 LOCALHOST_NAME.isPrefixOf(data.getName());
236 if (isViolatingLocalhost) {
237 NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<
238 " data=" << data.getName() << " violates /localhost");
239 // (drop)
Junxiao Shi88884492014-02-15 15:57:43 -0700240 return;
241 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700242
Junxiao Shid3c792f2014-01-30 00:46:13 -0700243 // PIT match
244 shared_ptr<pit::DataMatchResult> pitMatches = m_pit.findAllDataMatches(data);
245 if (pitMatches->begin() == pitMatches->end()) {
246 // goto Data unsolicited pipeline
247 this->onDataUnsolicited(inFace, data);
248 return;
249 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700250
Junxiao Shid3c792f2014-01-30 00:46:13 -0700251 // CS insert
252 m_cs.insert(data);
Junxiao Shic041ca32014-02-25 20:01:15 -0700253
Junxiao Shid3c792f2014-01-30 00:46:13 -0700254 std::set<shared_ptr<Face> > pendingDownstreams;
255 // foreach PitEntry
256 for (pit::DataMatchResult::iterator it = pitMatches->begin();
257 it != pitMatches->end(); ++it) {
258 shared_ptr<pit::Entry> pitEntry = *it;
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700259 NFD_LOG_DEBUG("onIncomingData matching=" << pitEntry->getName());
Junxiao Shic041ca32014-02-25 20:01:15 -0700260
Junxiao Shid3c792f2014-01-30 00:46:13 -0700261 // cancel unsatisfy & straggler timer
262 this->cancelUnsatisfyAndStragglerTimer(pitEntry);
Junxiao Shic041ca32014-02-25 20:01:15 -0700263
Junxiao Shid3c792f2014-01-30 00:46:13 -0700264 // remember pending downstreams
265 const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
266 for (pit::InRecordCollection::const_iterator it = inRecords.begin();
267 it != inRecords.end(); ++it) {
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700268 if (it->getExpiry() > time::steady_clock::now()) {
Junxiao Shid3c792f2014-01-30 00:46:13 -0700269 pendingDownstreams.insert(it->getFace());
270 }
271 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700272
Junxiao Shid938a6b2014-05-11 23:40:29 -0700273 // invoke PIT satisfy callback
274 this->dispatchToStrategy(pitEntry, bind(&Strategy::beforeSatisfyPendingInterest, _1,
275 pitEntry, cref(inFace), cref(data)));
276
Junxiao Shid3c792f2014-01-30 00:46:13 -0700277 // mark PIT satisfied
278 pitEntry->deleteInRecords();
279 pitEntry->deleteOutRecord(inFace.shared_from_this());
Junxiao Shic041ca32014-02-25 20:01:15 -0700280
Junxiao Shid3c792f2014-01-30 00:46:13 -0700281 // set PIT straggler timer
282 this->setStragglerTimer(pitEntry);
Junxiao Shid3c792f2014-01-30 00:46:13 -0700283 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700284
Junxiao Shid3c792f2014-01-30 00:46:13 -0700285 // foreach pending downstream
286 for (std::set<shared_ptr<Face> >::iterator it = pendingDownstreams.begin();
287 it != pendingDownstreams.end(); ++it) {
Junxiao Shida006f52014-05-16 11:18:00 -0700288 shared_ptr<Face> pendingDownstream = *it;
289 if (pendingDownstream.get() == &inFace) {
290 continue;
291 }
Junxiao Shid3c792f2014-01-30 00:46:13 -0700292 // goto outgoing Data pipeline
Junxiao Shida006f52014-05-16 11:18:00 -0700293 this->onOutgoingData(data, *pendingDownstream);
Junxiao Shid3c792f2014-01-30 00:46:13 -0700294 }
295}
296
297void
298Forwarder::onDataUnsolicited(Face& inFace, const Data& data)
299{
300 // accept to cache?
Junxiao Shif3c07812014-03-11 21:48:49 -0700301 bool acceptToCache = inFace.isLocal();
Junxiao Shid3c792f2014-01-30 00:46:13 -0700302 if (acceptToCache) {
303 // CS insert
Junxiao Shif3c07812014-03-11 21:48:49 -0700304 m_cs.insert(data, true);
Junxiao Shid3c792f2014-01-30 00:46:13 -0700305 }
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700306
Junxiao Shif3c07812014-03-11 21:48:49 -0700307 NFD_LOG_DEBUG("onDataUnsolicited face=" << inFace.getId() <<
308 " data=" << data.getName() <<
309 (acceptToCache ? " cached" : " not cached"));
Junxiao Shid3c792f2014-01-30 00:46:13 -0700310}
311
312void
313Forwarder::onOutgoingData(const Data& data, Face& outFace)
314{
Junxiao Shi223271b2014-07-03 22:06:13 -0700315 if (outFace.getId() == INVALID_FACEID) {
316 NFD_LOG_WARN("onOutgoingData face=invalid data=" << data.getName());
317 return;
318 }
Junxiao Shi8c8d2182014-01-30 22:33:00 -0700319 NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() << " data=" << data.getName());
320
Junxiao Shi9b27bd22014-02-26 20:29:58 -0700321 // /localhost scope control
Junxiao Shif3c07812014-03-11 21:48:49 -0700322 bool isViolatingLocalhost = !outFace.isLocal() &&
323 LOCALHOST_NAME.isPrefixOf(data.getName());
324 if (isViolatingLocalhost) {
325 NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() <<
326 " data=" << data.getName() << " violates /localhost");
327 // (drop)
Junxiao Shi9b27bd22014-02-26 20:29:58 -0700328 return;
329 }
330
Junxiao Shif3c07812014-03-11 21:48:49 -0700331 // TODO traffic manager
Junxiao Shic041ca32014-02-25 20:01:15 -0700332
Junxiao Shid3c792f2014-01-30 00:46:13 -0700333 // send Data
334 outFace.sendData(data);
Junxiao Shi33152f12014-07-16 19:54:32 -0700335 ++m_counters.getNOutDatas();
Junxiao Shid3c792f2014-01-30 00:46:13 -0700336}
337
338static inline bool
339compare_InRecord_expiry(const pit::InRecord& a, const pit::InRecord& b)
340{
341 return a.getExpiry() < b.getExpiry();
342}
343
344void
345Forwarder::setUnsatisfyTimer(shared_ptr<pit::Entry> pitEntry)
346{
347 const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
348 pit::InRecordCollection::const_iterator lastExpiring =
349 std::max_element(inRecords.begin(), inRecords.end(),
350 &compare_InRecord_expiry);
351
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700352 time::steady_clock::TimePoint lastExpiry = lastExpiring->getExpiry();
353 time::nanoseconds lastExpiryFromNow = lastExpiry - time::steady_clock::now();
Junxiao Shid3c792f2014-01-30 00:46:13 -0700354 if (lastExpiryFromNow <= time::seconds(0)) {
355 // TODO all InRecords are already expired; will this happen?
356 }
Junxiao Shic041ca32014-02-25 20:01:15 -0700357
Junxiao Shi9f7455b2014-04-07 21:02:16 -0700358 scheduler::cancel(pitEntry->m_unsatisfyTimer);
Junxiao Shic041ca32014-02-25 20:01:15 -0700359 pitEntry->m_unsatisfyTimer = scheduler::schedule(lastExpiryFromNow,
Junxiao Shid3c792f2014-01-30 00:46:13 -0700360 bind(&Forwarder::onInterestUnsatisfied, this, pitEntry));
361}
362
363void
364Forwarder::setStragglerTimer(shared_ptr<pit::Entry> pitEntry)
365{
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700366 time::nanoseconds stragglerTime = time::milliseconds(100);
Junxiao Shic041ca32014-02-25 20:01:15 -0700367
Junxiao Shi9f7455b2014-04-07 21:02:16 -0700368 scheduler::cancel(pitEntry->m_stragglerTimer);
Junxiao Shic041ca32014-02-25 20:01:15 -0700369 pitEntry->m_stragglerTimer = scheduler::schedule(stragglerTime,
Haowei Yuan78c84d12014-02-27 15:35:13 -0600370 bind(&Pit::erase, &m_pit, pitEntry));
Junxiao Shid3c792f2014-01-30 00:46:13 -0700371}
372
373void
374Forwarder::cancelUnsatisfyAndStragglerTimer(shared_ptr<pit::Entry> pitEntry)
375{
Junxiao Shic041ca32014-02-25 20:01:15 -0700376 scheduler::cancel(pitEntry->m_unsatisfyTimer);
377 scheduler::cancel(pitEntry->m_stragglerTimer);
Junxiao Shid3c792f2014-01-30 00:46:13 -0700378}
379
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800380} // namespace nfd