blob: 12b6feb1aa88c42bc221c0e6107a56c07899204c [file] [log] [blame]
Yingdi Yuf7ede412014-08-30 20:37:52 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Ashlesh Gawande9a306fe2019-01-04 11:38:18 -06003 * Copyright (c) 2012-2019 University of California, Los Angeles
Yingdi Yuf7ede412014-08-30 20:37:52 -07004 *
5 * This file is part of ChronoSync, synchronization library for distributed realtime
6 * applications for NDN.
7 *
8 * ChronoSync is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/>
20 * @author Chaoyi Bian <bcy@pku.edu.cn>
21 * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
22 * @author Yingdi Yu <yingdi@cs.ucla.edu>
Sonu Mishra0dadc572016-12-12 23:59:41 -080023 * @author Sonu Mishra <https://www.linkedin.com/in/mishrasonu>
Yingdi Yuf7ede412014-08-30 20:37:52 -070024 */
25
26#include "logic.hpp"
27#include "logger.hpp"
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -050028#include "bzip2-helper.hpp"
Yingdi Yuf7ede412014-08-30 20:37:52 -070029
Alexander Afanasyev89036292018-02-13 17:19:50 -050030#include <ndn-cxx/util/backports.hpp>
Ashlesh Gawande687cf922017-05-30 15:04:16 -050031#include <ndn-cxx/util/string-helper.hpp>
32
Alexander Afanasyev36eb3ed2017-01-11 12:35:58 -080033INIT_LOGGER(Logic);
Yingdi Yuf7ede412014-08-30 20:37:52 -070034
Yingdi Yuf7ede412014-08-30 20:37:52 -070035#define _LOG_DEBUG_ID(v) _LOG_DEBUG("Instance" << m_instanceId << ": " << v)
Yingdi Yuf7ede412014-08-30 20:37:52 -070036
37namespace chronosync {
38
Yingdi Yuf7ede412014-08-30 20:37:52 -070039const uint8_t EMPTY_DIGEST_VALUE[] = {
40 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
41 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
42 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
43 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55
44};
45
Ashlesh Gawande08784d42017-09-06 23:40:21 -050046int Logic::s_instanceCounter = 0;
Yingdi Yuf7ede412014-08-30 20:37:52 -070047
Yingdi Yucd339022014-11-05 17:51:19 -080048const ndn::Name Logic::DEFAULT_NAME;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -080049const ndn::Name Logic::EMPTY_NAME;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050050const std::shared_ptr<Validator> Logic::DEFAULT_VALIDATOR;
Yingdi Yuf7ede412014-08-30 20:37:52 -070051const time::steady_clock::Duration Logic::DEFAULT_RESET_TIMER = time::seconds(0);
52const time::steady_clock::Duration Logic::DEFAULT_CANCEL_RESET_TIMER = time::milliseconds(500);
53const time::milliseconds Logic::DEFAULT_RESET_INTEREST_LIFETIME(1000);
54const time::milliseconds Logic::DEFAULT_SYNC_INTEREST_LIFETIME(1000);
55const time::milliseconds Logic::DEFAULT_SYNC_REPLY_FRESHNESS(1000);
Sonu Mishra4d3a2e02017-01-18 20:27:51 -080056const time::milliseconds Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME(1000);
Yingdi Yuf7ede412014-08-30 20:37:52 -070057
Ashlesh Gawande08784d42017-09-06 23:40:21 -050058const ConstBufferPtr Logic::EMPTY_DIGEST(new ndn::Buffer(EMPTY_DIGEST_VALUE, 32));
Yingdi Yuf7ede412014-08-30 20:37:52 -070059const ndn::name::Component Logic::RESET_COMPONENT("reset");
Sonu Mishra4d3a2e02017-01-18 20:27:51 -080060const ndn::name::Component Logic::RECOVERY_COMPONENT("recovery");
Yingdi Yuf7ede412014-08-30 20:37:52 -070061
Alexander Afanasyev89036292018-02-13 17:19:50 -050062const size_t NDNLP_EXPECTED_OVERHEAD = 20;
63
64/**
65 * Get maximum packet limit
66 *
67 * By default, it returns `ndn::MAX_NDN_PACKET_SIZE`.
68 * The returned value can be customized using the environment variable `CHRONOSYNC_MAX_PACKET_SIZE`,
69 * but the returned value will be at least 500 and no more than `ndn::MAX_NDN_PACKET_SIZE`.
70 */
71#ifndef CHRONOSYNC_HAVE_TESTS
72static
73#endif // CHRONOSYNC_HAVE_TESTS
74size_t
75getMaxPacketLimit()
76{
77 static size_t limit = 0;
78#ifndef CHRONOSYNC_HAVE_TESTS
79 if (limit != 0) {
80 return limit;
81 }
82#endif // CHRONOSYNC_HAVE_TESTS
83
84 if (getenv("CHRONOSYNC_MAX_PACKET_SIZE") != nullptr) {
85 try {
86 limit = ndn::clamp<size_t>(boost::lexical_cast<size_t>(getenv("CHRONOSYNC_MAX_PACKET_SIZE")),
87 500, ndn::MAX_NDN_PACKET_SIZE);
88 }
89 catch (const boost::bad_lexical_cast&) {
90 limit = ndn::MAX_NDN_PACKET_SIZE;
91 }
92 }
93 else {
94 limit = ndn::MAX_NDN_PACKET_SIZE;
95 }
96
97 return limit;
98}
99
Yingdi Yuf7ede412014-08-30 20:37:52 -0700100Logic::Logic(ndn::Face& face,
101 const Name& syncPrefix,
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800102 const Name& defaultUserPrefix,
Yingdi Yuf7ede412014-08-30 20:37:52 -0700103 const UpdateCallback& onUpdate,
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800104 const Name& defaultSigningId,
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500105 std::shared_ptr<Validator> validator,
Yingdi Yuf7ede412014-08-30 20:37:52 -0700106 const time::steady_clock::Duration& resetTimer,
107 const time::steady_clock::Duration& cancelResetTimer,
108 const time::milliseconds& resetInterestLifetime,
109 const time::milliseconds& syncInterestLifetime,
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800110 const time::milliseconds& syncReplyFreshness,
Alexander Afanasyevbf5bc6c2018-02-19 11:26:09 -0500111 const time::milliseconds& recoveryInterestLifetime,
112 const name::Component& session)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700113 : m_face(face)
114 , m_syncPrefix(syncPrefix)
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400115 , m_syncReset(Name(syncPrefix).append("reset"))
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800116 , m_defaultUserPrefix(defaultUserPrefix)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700117 , m_interestTable(m_face.getIoService())
Yingdi Yuf7ede412014-08-30 20:37:52 -0700118 , m_isInReset(false)
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400119 , m_needPeriodReset(resetTimer > time::nanoseconds::zero())
Yingdi Yuf7ede412014-08-30 20:37:52 -0700120 , m_onUpdate(onUpdate)
121 , m_scheduler(m_face.getIoService())
Ashlesh Gawande9a306fe2019-01-04 11:38:18 -0600122 , m_rng(ndn::random::getRandomNumberEngine())
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600123 , m_rangeUniformRandom(100, 500)
124 , m_reexpressionJitter(100, 500)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700125 , m_resetTimer(resetTimer)
126 , m_cancelResetTimer(cancelResetTimer)
127 , m_resetInterestLifetime(resetInterestLifetime)
128 , m_syncInterestLifetime(syncInterestLifetime)
129 , m_syncReplyFreshness(syncReplyFreshness)
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800130 , m_recoveryInterestLifetime(recoveryInterestLifetime)
Yingdi Yucd339022014-11-05 17:51:19 -0800131 , m_validator(validator)
Alexander Afanasyev90587b82018-02-11 20:36:53 -0500132 , m_instanceId(s_instanceCounter++)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700133{
Yingdi Yuf7ede412014-08-30 20:37:52 -0700134 _LOG_DEBUG_ID(">> Logic::Logic");
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400135 addUserNode(m_defaultUserPrefix, defaultSigningId, session, false);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700136
137 _LOG_DEBUG_ID("Listen to: " << m_syncPrefix);
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700138 m_syncRegisteredPrefix = m_face.setInterestFilter(
139 ndn::InterestFilter(m_syncPrefix).allowLoopback(false),
140 bind(&Logic::onSyncInterest, this, _1, _2),
141 bind(&Logic::onSyncRegisterFailed, this, _1, _2));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700142
Qiuhan Dinge246b622014-12-03 21:57:48 -0800143 sendSyncInterest();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700144 _LOG_DEBUG_ID("<< Logic::Logic");
145}
146
147Logic::~Logic()
148{
Nick Gordon0b3beab2018-03-02 13:03:28 -0600149 _LOG_DEBUG_ID(">> Logic::~Logic");
Yingdi Yu9d5679a2015-02-01 00:17:58 -0800150 m_interestTable.clear();
Nick Gordon0b3beab2018-03-02 13:03:28 -0600151 m_scheduler.cancelAllEvents();
152 _LOG_DEBUG_ID("<< Logic::~Logic");
Yingdi Yuf7ede412014-08-30 20:37:52 -0700153}
154
155void
Qiuhan Dingfb8c9e02015-01-30 14:04:55 -0800156Logic::reset(bool isOnInterest)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700157{
158 m_isInReset = true;
159
160 m_state.reset();
161 m_log.clear();
162
Qiuhan Dingfb8c9e02015-01-30 14:04:55 -0800163 if (!isOnInterest)
164 sendResetInterest();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700165
Yingdi Yuf7ede412014-08-30 20:37:52 -0700166 sendSyncInterest();
167
Davide Pesaventod057cf12019-03-20 23:38:40 -0400168 m_delayedInterestProcessingId = m_scheduler.schedule(m_cancelResetTimer, [this] { cancelReset(); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700169}
170
171void
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800172Logic::setDefaultUserPrefix(const Name& defaultUserPrefix)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700173{
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800174 if (defaultUserPrefix != EMPTY_NAME) {
175 if (m_nodeList.find(defaultUserPrefix) != m_nodeList.end()) {
176 m_defaultUserPrefix = defaultUserPrefix;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800177 }
178 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700179}
180
181void
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400182Logic::addUserNode(const Name& userPrefix, const Name& signingId, const name::Component& session, bool shouldSendReset)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700183{
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800184 if (userPrefix == EMPTY_NAME)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700185 return;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800186 if (m_defaultUserPrefix == EMPTY_NAME) {
187 m_defaultUserPrefix = userPrefix;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800188 }
189 if (m_nodeList.find(userPrefix) == m_nodeList.end()) {
190 m_nodeList[userPrefix].userPrefix = userPrefix;
191 m_nodeList[userPrefix].signingId = signingId;
192 Name sessionName = userPrefix;
Alexander Afanasyevbf5bc6c2018-02-19 11:26:09 -0500193 if (!session.empty()) {
194 sessionName.append(session);
195 }
196 else {
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400197 sessionName.appendNumber(time::toUnixTimestamp(time::system_clock::now()).count());
Alexander Afanasyevbf5bc6c2018-02-19 11:26:09 -0500198 }
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800199 m_nodeList[userPrefix].sessionName = sessionName;
200 m_nodeList[userPrefix].seqNo = 0;
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400201 reset(!shouldSendReset);
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800202 }
203}
Yingdi Yuf7ede412014-08-30 20:37:52 -0700204
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800205void
206Logic::removeUserNode(const Name& userPrefix)
207{
208 auto userNode = m_nodeList.find(userPrefix);
209 if (userNode != m_nodeList.end()) {
210 m_nodeList.erase(userNode);
211 if (m_defaultUserPrefix == userPrefix) {
212 if (!m_nodeList.empty()) {
213 m_defaultUserPrefix = m_nodeList.begin()->second.userPrefix;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800214 }
215 else {
216 m_defaultUserPrefix = EMPTY_NAME;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800217 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700218 }
Qiuhan Dingfb8c9e02015-01-30 14:04:55 -0800219 reset(false);
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800220 }
221}
Yingdi Yuf7ede412014-08-30 20:37:52 -0700222
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800223const Name&
224Logic::getSessionName(Name prefix)
225{
226 if (prefix == EMPTY_NAME)
227 prefix = m_defaultUserPrefix;
228 auto node = m_nodeList.find(prefix);
229 if (node != m_nodeList.end())
230 return node->second.sessionName;
231 else
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800232 BOOST_THROW_EXCEPTION(Error("Refer to non-existent node:" + prefix.toUri()));
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800233}
Yingdi Yuf7ede412014-08-30 20:37:52 -0700234
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800235const SeqNo&
236Logic::getSeqNo(Name prefix)
237{
238 if (prefix == EMPTY_NAME)
239 prefix = m_defaultUserPrefix;
240 auto node = m_nodeList.find(prefix);
241 if (node != m_nodeList.end())
242 return node->second.seqNo;
243 else
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800244 BOOST_THROW_EXCEPTION(Logic::Error("Refer to non-existent node:" + prefix.toUri()));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700245
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800246}
247
248void
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800249Logic::updateSeqNo(const SeqNo& seqNo, const Name& updatePrefix)
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800250{
251 Name prefix;
252 if (updatePrefix == EMPTY_NAME) {
253 if (m_defaultUserPrefix == EMPTY_NAME)
254 return;
255 prefix = m_defaultUserPrefix;
256 }
257 else
258 prefix = updatePrefix;
259
260 auto it = m_nodeList.find(prefix);
261 if (it != m_nodeList.end()) {
262 NodeInfo& node = it->second;
263 _LOG_DEBUG_ID(">> Logic::updateSeqNo");
264 _LOG_DEBUG_ID("seqNo: " << seqNo << " m_seqNo: " << node.seqNo);
265 if (seqNo < node.seqNo || seqNo == 0)
266 return;
267
268 node.seqNo = seqNo;
269 _LOG_DEBUG_ID("updateSeqNo: m_seqNo " << node.seqNo);
270
271 if (!m_isInReset) {
272 _LOG_DEBUG_ID("updateSeqNo: not in Reset ");
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500273 ConstBufferPtr previousRoot = m_state.getRootDigest();
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800274 {
Davide Pesavento5473abe2017-10-09 01:35:33 -0400275 std::string hash = ndn::toHex(previousRoot->data(), previousRoot->size(), false);
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800276 _LOG_DEBUG_ID("Hash: " << hash);
277 }
278
279 bool isInserted = false;
280 bool isUpdated = false;
281 SeqNo oldSeq;
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500282 std::tie(isInserted, isUpdated, oldSeq) = m_state.update(node.sessionName, node.seqNo);
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800283
284 _LOG_DEBUG_ID("Insert: " << std::boolalpha << isInserted);
285 _LOG_DEBUG_ID("Updated: " << std::boolalpha << isUpdated);
286 if (isInserted || isUpdated) {
287 DiffStatePtr commit = make_shared<DiffState>();
288 commit->update(node.sessionName, node.seqNo);
289 commit->setRootDigest(m_state.getRootDigest());
290 insertToDiffLog(commit, previousRoot);
291
292 satisfyPendingSyncInterests(prefix, commit);
Alexander Afanasyevfcbf81d2018-02-19 10:25:46 -0500293 // formAndSendExcludeInterest(prefix, *commit, previousRoot);
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800294 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700295 }
296 }
297}
298
299ConstBufferPtr
300Logic::getRootDigest() const
301{
302 return m_state.getRootDigest();
303}
304
305void
306Logic::printState(std::ostream& os) const
307{
Nick Gordon0b3beab2018-03-02 13:03:28 -0600308 for (const auto& leaf : m_state.getLeaves()) {
309 os << *leaf << "\n";
310 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700311}
312
313std::set<Name>
314Logic::getSessionNames() const
315{
316 std::set<Name> sessionNames;
Nick Gordon0b3beab2018-03-02 13:03:28 -0600317 for (const auto& leaf : m_state.getLeaves()) {
318 sessionNames.insert(leaf->getSessionName());
319 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700320 return sessionNames;
321}
322
323void
324Logic::onSyncInterest(const Name& prefix, const Interest& interest)
325{
326 _LOG_DEBUG_ID(">> Logic::onSyncInterest");
327 Name name = interest.getName();
328
329 _LOG_DEBUG_ID("InterestName: " << name);
330
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800331 if (name.size() >= 1 && RESET_COMPONENT == name.get(-1)) {
332 processResetInterest(interest);
333 }
334 else if (name.size() >= 2 && RECOVERY_COMPONENT == name.get(-2)) {
335 processRecoveryInterest(interest);
336 }
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500337 else {
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500338 processSyncInterest(interest);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700339 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700340
341 _LOG_DEBUG_ID("<< Logic::onSyncInterest");
342}
343
344void
345Logic::onSyncRegisterFailed(const Name& prefix, const std::string& msg)
346{
347 //Sync prefix registration failed
348 _LOG_DEBUG_ID(">> Logic::onSyncRegisterFailed");
349}
350
351void
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800352Logic::onSyncData(const Interest& interest, const Data& data)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700353{
354 _LOG_DEBUG_ID(">> Logic::onSyncData");
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500355 if (m_validator != nullptr)
356 m_validator->validate(data,
357 bind(&Logic::onSyncDataValidated, this, _1),
358 bind(&Logic::onSyncDataValidationFailed, this, _1));
359 else
360 onSyncDataValidated(data);
Sonu Mishraf42aa2c2017-01-22 18:47:33 -0800361
Yingdi Yuf7ede412014-08-30 20:37:52 -0700362 _LOG_DEBUG_ID("<< Logic::onSyncData");
363}
364
365void
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800366Logic::onResetData(const Interest& interest, const Data& data)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700367{
368 // This should not happened, drop the received data.
369}
370
371void
372Logic::onSyncTimeout(const Interest& interest)
373{
374 // It is OK. Others will handle the time out situation.
375 _LOG_DEBUG_ID(">> Logic::onSyncTimeout");
376 _LOG_DEBUG_ID("Interest: " << interest.getName());
377 _LOG_DEBUG_ID("<< Logic::onSyncTimeout");
378}
379
380void
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500381Logic::onSyncDataValidationFailed(const Data& data)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700382{
383 // SyncReply cannot be validated.
384}
385
386void
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500387Logic::onSyncDataValidated(const Data& data)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700388{
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500389 Name name = data.getName();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700390 ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
391
Alexander Afanasyevfcbf81d2018-02-19 10:25:46 -0500392 try {
393 auto contentBuffer = bzip2::decompress(reinterpret_cast<const char*>(data.getContent().value()),
394 data.getContent().value_size());
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500395 processSyncData(name, digest, Block(std::move(contentBuffer)));
Alexander Afanasyevfcbf81d2018-02-19 10:25:46 -0500396 }
397 catch (const std::ios_base::failure& error) {
398 _LOG_WARN("Error decompressing content of " << data.getName() << " (" << error.what() << ")");
399 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700400}
401
402void
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500403Logic::processSyncInterest(const Interest& interest, bool isTimedProcessing/*=false*/)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700404{
405 _LOG_DEBUG_ID(">> Logic::processSyncInterest");
406
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500407 Name name = interest.getName();
408 ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
Yingdi Yuf7ede412014-08-30 20:37:52 -0700409
410 ConstBufferPtr rootDigest = m_state.getRootDigest();
411
412 // If the digest of the incoming interest is the same as root digest
413 // Put the interest into InterestTable
414 if (*rootDigest == *digest) {
415 _LOG_DEBUG_ID("Oh, we are in the same state");
416 m_interestTable.insert(interest, digest, false);
417
418 if (!m_isInReset)
419 return;
420
421 if (!isTimedProcessing) {
422 _LOG_DEBUG_ID("Non timed processing in reset");
423 // Still in reset, our own seq has not been put into state yet
424 // Do not hurry, some others may be also resetting and may send their reply
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600425 time::milliseconds after(m_rangeUniformRandom(m_rng));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700426 _LOG_DEBUG_ID("After: " << after);
Davide Pesaventod057cf12019-03-20 23:38:40 -0400427 m_delayedInterestProcessingId = m_scheduler.schedule(after,
428 [=] { processSyncInterest(interest, true); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700429 }
430 else {
431 _LOG_DEBUG_ID("Timed processing in reset");
432 // Now we can get out of reset state by putting our own stuff into m_state.
433 cancelReset();
434 }
435
436 return;
437 }
438
439 // If the digest of incoming interest is an "empty" digest
Sonu Mishrae10acbc2017-01-18 14:14:05 -0800440 if (*digest == *EMPTY_DIGEST) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700441 _LOG_DEBUG_ID("Poor guy, he knows nothing");
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800442 sendSyncData(m_defaultUserPrefix, name, m_state);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700443 return;
444 }
445
446 DiffStateContainer::iterator stateIter = m_log.find(digest);
447 // If the digest of incoming interest can be found from the log
448 if (stateIter != m_log.end()) {
449 _LOG_DEBUG_ID("It is ok, you are so close");
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800450 sendSyncData(m_defaultUserPrefix, name, *(*stateIter)->diff());
Yingdi Yuf7ede412014-08-30 20:37:52 -0700451 return;
452 }
453
454 if (!isTimedProcessing) {
455 _LOG_DEBUG_ID("Let's wait, just wait for a while");
456 // Do not hurry, some incoming SyncReplies may help us to recognize the digest
Yingdi Yu53f5f042015-01-31 16:33:25 -0800457 m_interestTable.insert(interest, digest, true);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700458
459 m_delayedInterestProcessingId =
Davide Pesaventod057cf12019-03-20 23:38:40 -0400460 m_scheduler.schedule(time::milliseconds(m_rangeUniformRandom(m_rng)),
461 [=] { processSyncInterest(interest, true); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700462 }
463 else {
464 // OK, nobody is helping us, just tell the truth.
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800465 _LOG_DEBUG_ID("OK, nobody is helping us, let us try to recover");
Yingdi Yuf7ede412014-08-30 20:37:52 -0700466 m_interestTable.erase(digest);
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800467 sendRecoveryInterest(digest);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700468 }
469
470 _LOG_DEBUG_ID("<< Logic::processSyncInterest");
471}
472
473void
474Logic::processResetInterest(const Interest& interest)
475{
476 _LOG_DEBUG_ID(">> Logic::processResetInterest");
Qiuhan Dingfb8c9e02015-01-30 14:04:55 -0800477 reset(true);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700478}
479
480void
481Logic::processSyncData(const Name& name,
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500482 ConstBufferPtr digest,
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500483 const Block& syncReplyBlock)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700484{
485 _LOG_DEBUG_ID(">> Logic::processSyncData");
Yingdi Yuf7ede412014-08-30 20:37:52 -0700486 DiffStatePtr commit = make_shared<DiffState>();
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500487 ConstBufferPtr previousRoot = m_state.getRootDigest();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700488
489 try {
490 m_interestTable.erase(digest); // Remove satisfied interest from PIT
491
492 State reply;
493 reply.wireDecode(syncReplyBlock);
494
495 std::vector<MissingDataInfo> v;
Davide Pesaventod057cf12019-03-20 23:38:40 -0400496 BOOST_FOREACH(ConstLeafPtr leaf, reply.getLeaves().get<ordered>()) {
497 BOOST_ASSERT(leaf != nullptr);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700498
Davide Pesaventod057cf12019-03-20 23:38:40 -0400499 const Name& info = leaf->getSessionName();
500 SeqNo seq = leaf->getSeq();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700501
Davide Pesaventod057cf12019-03-20 23:38:40 -0400502 bool isInserted = false;
503 bool isUpdated = false;
504 SeqNo oldSeq;
505 std::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq);
506 if (isInserted || isUpdated) {
507 commit->update(info, seq);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700508
Davide Pesaventod057cf12019-03-20 23:38:40 -0400509 oldSeq++;
510 MissingDataInfo mdi = {info, oldSeq, seq};
511 v.push_back(mdi);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700512 }
Davide Pesaventod057cf12019-03-20 23:38:40 -0400513 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700514
515 if (!v.empty()) {
516 m_onUpdate(v);
517
518 commit->setRootDigest(m_state.getRootDigest());
519 insertToDiffLog(commit, previousRoot);
520 }
521 else {
522 _LOG_DEBUG_ID("What? nothing new");
523 }
524 }
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800525 catch (const State::Error&) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700526 _LOG_DEBUG_ID("Something really fishy happened during state decoding");
527 // Something really fishy happened during state decoding;
528 commit.reset();
529 return;
530 }
531
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500532 if (static_cast<bool>(commit) && !commit->getLeaves().empty()) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700533 // state changed and it is safe to express a new interest
Junxiao Shic4902122019-02-08 15:13:50 -0700534 auto after = time::milliseconds(m_reexpressionJitter(m_rng));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700535 _LOG_DEBUG_ID("Reschedule sync interest after: " << after);
Davide Pesaventod057cf12019-03-20 23:38:40 -0400536 m_reexpressingInterestId = m_scheduler.schedule(after, [this] { sendSyncInterest(); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700537 }
538}
539
540void
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800541Logic::satisfyPendingSyncInterests(const Name& updatedPrefix, ConstDiffStatePtr commit)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700542{
543 _LOG_DEBUG_ID(">> Logic::satisfyPendingSyncInterests");
544 try {
545 _LOG_DEBUG_ID("InterestTable size: " << m_interestTable.size());
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500546 auto it = m_interestTable.begin();
547 while (it != m_interestTable.end()) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700548 ConstUnsatisfiedInterestPtr request = *it;
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500549 ++it;
Yingdi Yuf7ede412014-08-30 20:37:52 -0700550 if (request->isUnknown)
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500551 sendSyncData(updatedPrefix, request->interest.getName(), m_state);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700552 else
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500553 sendSyncData(updatedPrefix, request->interest.getName(), *commit);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700554 }
555 m_interestTable.clear();
556 }
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800557 catch (const InterestTable::Error&) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700558 // ok. not really an error
559 }
560 _LOG_DEBUG_ID("<< Logic::satisfyPendingSyncInterests");
561}
562
563void
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500564Logic::insertToDiffLog(DiffStatePtr commit, ConstBufferPtr previousRoot)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700565{
566 _LOG_DEBUG_ID(">> Logic::insertToDiffLog");
567 // Connect to the history
568 if (!m_log.empty())
569 (*m_log.find(previousRoot))->setNext(commit);
570
571 // Insert the commit
572 m_log.erase(commit->getRootDigest());
573 m_log.insert(commit);
574 _LOG_DEBUG_ID("<< Logic::insertToDiffLog");
575}
576
577void
578Logic::sendResetInterest()
579{
580 _LOG_DEBUG_ID(">> Logic::sendResetInterest");
581
582 if (m_needPeriodReset) {
583 _LOG_DEBUG_ID("Need Period Reset");
584 _LOG_DEBUG_ID("ResetTimer: " << m_resetTimer);
585
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400586 m_resetInterestId = m_scheduler.schedule(m_resetTimer + time::milliseconds(m_reexpressionJitter(m_rng)),
Davide Pesaventod057cf12019-03-20 23:38:40 -0400587 [this] { sendResetInterest(); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700588 }
589
590 Interest interest(m_syncReset);
591 interest.setMustBeFresh(true);
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500592 interest.setCanBePrefix(false); // no data is expected
Yingdi Yuf7ede412014-08-30 20:37:52 -0700593 interest.setInterestLifetime(m_resetInterestLifetime);
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700594
595 // Assigning to m_pendingResetInterest cancels the previous reset Interest.
596 // This is harmless since no Data is expected.
597 m_pendingResetInterest = m_face.expressInterest(interest,
Nick Gordon0b3beab2018-03-02 13:03:28 -0600598 bind(&Logic::onResetData, this, _1, _2),
599 bind(&Logic::onSyncTimeout, this, _1), // Nack
600 bind(&Logic::onSyncTimeout, this, _1));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700601 _LOG_DEBUG_ID("<< Logic::sendResetInterest");
602}
603
604void
605Logic::sendSyncInterest()
606{
607 _LOG_DEBUG_ID(">> Logic::sendSyncInterest");
608
609 Name interestName;
610 interestName.append(m_syncPrefix)
611 .append(ndn::name::Component(*m_state.getRootDigest()));
612
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700613 m_pendingSyncInterestName = interestName;
Yingdi Yuf7ede412014-08-30 20:37:52 -0700614
615#ifdef _DEBUG
616 printDigest(m_state.getRootDigest());
617#endif
618
Davide Pesaventod057cf12019-03-20 23:38:40 -0400619 m_reexpressingInterestId = m_scheduler.schedule(m_syncInterestLifetime / 2 +
Davide Pesaventod7de2d42019-08-01 20:55:50 -0400620 time::milliseconds(m_reexpressionJitter(m_rng)),
Davide Pesaventod057cf12019-03-20 23:38:40 -0400621 [this] { sendSyncInterest(); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700622
623 Interest interest(interestName);
624 interest.setMustBeFresh(true);
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500625 interest.setCanBePrefix(true);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700626 interest.setInterestLifetime(m_syncInterestLifetime);
627
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700628 m_pendingSyncInterest = m_face.expressInterest(interest,
629 bind(&Logic::onSyncData, this, _1, _2),
630 bind(&Logic::onSyncTimeout, this, _1), // Nack
631 bind(&Logic::onSyncTimeout, this, _1));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700632
633 _LOG_DEBUG_ID("Send interest: " << interest.getName());
634 _LOG_DEBUG_ID("<< Logic::sendSyncInterest");
635}
636
637void
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500638Logic::trimState(State& partialState, const State& state, size_t nExcludedStates)
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600639{
640 partialState.reset();
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500641
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600642 std::vector<ConstLeafPtr> leaves;
643 for (const ConstLeafPtr& leaf : state.getLeaves()) {
644 leaves.push_back(leaf);
645 }
646
647 std::shuffle(leaves.begin(), leaves.end(), m_rng);
648
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500649 size_t statesToEncode = leaves.size() - std::min(leaves.size() - 1, nExcludedStates);
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600650 for (const auto& constLeafPtr : leaves) {
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500651 if (statesToEncode == 0) {
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600652 break;
653 }
654 partialState.update(constLeafPtr->getSessionName(), constLeafPtr->getSeq());
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500655 --statesToEncode;
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600656 }
657}
658
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500659Data
660Logic::encodeSyncReply(const Name& nodePrefix, const Name& name, const State& state)
661{
662 Data syncReply(name);
663 syncReply.setFreshnessPeriod(m_syncReplyFreshness);
664
665 auto finalizeReply = [this, &nodePrefix, &syncReply] (const State& state) {
666 auto contentBuffer = bzip2::compress(reinterpret_cast<const char*>(state.wireEncode().wire()),
667 state.wireEncode().size());
668 syncReply.setContent(contentBuffer);
669
670 if (m_nodeList[nodePrefix].signingId.empty())
671 m_keyChain.sign(syncReply);
672 else
673 m_keyChain.sign(syncReply, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
674 };
675
676 finalizeReply(state);
677
678 size_t nExcludedStates = 1;
679 while (syncReply.wireEncode().size() > getMaxPacketLimit() - NDNLP_EXPECTED_OVERHEAD) {
680 if (nExcludedStates == 1) {
681 // To show this debug message only once
682 _LOG_DEBUG("Sync reply size exceeded maximum packet limit (" << (getMaxPacketLimit() - NDNLP_EXPECTED_OVERHEAD) << ")");
683 }
684 State partialState;
685 trimState(partialState, state, nExcludedStates);
686 finalizeReply(partialState);
687
688 BOOST_ASSERT(state.getLeaves().size() != 0);
689 nExcludedStates *= 2;
690 }
691
692 return syncReply;
693}
694
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600695void
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800696Logic::sendSyncData(const Name& nodePrefix, const Name& name, const State& state)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700697{
698 _LOG_DEBUG_ID(">> Logic::sendSyncData");
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600699 if (m_nodeList.find(nodePrefix) == m_nodeList.end())
700 return;
701
Alexander Afanasyev6ee98ff2018-02-13 19:12:28 -0500702 m_face.put(encodeSyncReply(nodePrefix, name, state));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700703
704 // checking if our own interest got satisfied
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700705 if (m_pendingSyncInterestName == name) {
Yingdi Yuf7ede412014-08-30 20:37:52 -0700706 // remove outstanding interest
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700707 m_pendingSyncInterest.cancel();
Yingdi Yuf7ede412014-08-30 20:37:52 -0700708
709 // re-schedule sending Sync interest
Ashlesh Gawande4a9ecd52018-02-06 14:36:19 -0600710 time::milliseconds after(m_reexpressionJitter(m_rng));
Yingdi Yuf7ede412014-08-30 20:37:52 -0700711 _LOG_DEBUG_ID("Satisfy our own interest");
712 _LOG_DEBUG_ID("Reschedule sync interest after " << after);
Davide Pesaventod057cf12019-03-20 23:38:40 -0400713 m_reexpressingInterestId = m_scheduler.schedule(after, [this] { sendSyncInterest(); });
Yingdi Yuf7ede412014-08-30 20:37:52 -0700714 }
715 _LOG_DEBUG_ID("<< Logic::sendSyncData");
716}
717
718void
719Logic::cancelReset()
720{
721 _LOG_DEBUG_ID(">> Logic::cancelReset");
722 if (!m_isInReset)
723 return;
724
725 m_isInReset = false;
Qiuhan Ding8c095fd2014-11-19 17:38:32 -0800726 for (const auto& node : m_nodeList) {
727 updateSeqNo(node.second.seqNo, node.first);
728 }
Yingdi Yuf7ede412014-08-30 20:37:52 -0700729 _LOG_DEBUG_ID("<< Logic::cancelReset");
730}
731
732void
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500733Logic::printDigest(ConstBufferPtr digest)
Yingdi Yuf7ede412014-08-30 20:37:52 -0700734{
Davide Pesavento5473abe2017-10-09 01:35:33 -0400735 std::string hash = ndn::toHex(digest->data(), digest->size(), false);
Yingdi Yuf7ede412014-08-30 20:37:52 -0700736 _LOG_DEBUG_ID("Hash: " << hash);
737}
738
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800739void
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500740Logic::sendRecoveryInterest(ConstBufferPtr digest)
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800741{
742 _LOG_DEBUG_ID(">> Logic::sendRecoveryInterest");
743
744 Name interestName;
745 interestName.append(m_syncPrefix)
746 .append(RECOVERY_COMPONENT)
747 .append(ndn::name::Component(*digest));
748
749 Interest interest(interestName);
750 interest.setMustBeFresh(true);
Ashlesh Gawande1d1092d2018-08-03 14:36:49 -0500751 interest.setCanBePrefix(true);
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800752 interest.setInterestLifetime(m_recoveryInterestLifetime);
753
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700754 m_pendingRecoveryInterests[interestName[-1].toUri()] = m_face.expressInterest(interest,
Nick Gordon0b3beab2018-03-02 13:03:28 -0600755 bind(&Logic::onRecoveryData, this, _1, _2),
756 bind(&Logic::onRecoveryTimeout, this, _1), // Nack
757 bind(&Logic::onRecoveryTimeout, this, _1));
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800758 _LOG_DEBUG_ID("interest: " << interest.getName());
759 _LOG_DEBUG_ID("<< Logic::sendRecoveryInterest");
760}
761
762void
763Logic::processRecoveryInterest(const Interest& interest)
764{
765 _LOG_DEBUG_ID(">> Logic::processRecoveryInterest");
766
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500767 Name name = interest.getName();
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800768 ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
769
770 ConstBufferPtr rootDigest = m_state.getRootDigest();
771
772 DiffStateContainer::iterator stateIter = m_log.find(digest);
773
774 if (stateIter != m_log.end() || *digest == *EMPTY_DIGEST || *rootDigest == *digest) {
775 _LOG_DEBUG_ID("I can help you recover");
776 sendSyncData(m_defaultUserPrefix, name, m_state);
777 return;
778 }
779 _LOG_DEBUG_ID("<< Logic::processRecoveryInterest");
780}
781
782void
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800783Logic::onRecoveryData(const Interest& interest, const Data& data)
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800784{
785 _LOG_DEBUG_ID(">> Logic::onRecoveryData");
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700786 m_pendingRecoveryInterests.erase(interest.getName()[-1].toUri());
Ashlesh Gawande08784d42017-09-06 23:40:21 -0500787 onSyncDataValidated(data);
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800788 _LOG_DEBUG_ID("<< Logic::onRecoveryData");
789}
790
791void
792Logic::onRecoveryTimeout(const Interest& interest)
793{
794 _LOG_DEBUG_ID(">> Logic::onRecoveryTimeout");
Junxiao Shi8e4e76d2019-02-08 15:25:08 -0700795 m_pendingRecoveryInterests.erase(interest.getName()[-1].toUri());
Sonu Mishra4d3a2e02017-01-18 20:27:51 -0800796 _LOG_DEBUG_ID("Interest: " << interest.getName());
797 _LOG_DEBUG_ID("<< Logic::onRecoveryTimeout");
798}
799
Alexander Afanasyeve9eda8a2017-03-09 14:40:03 -0800800} // namespace chronosync