diff --git a/src/dag/dag-module.cpp b/src/dag/dag-module.cpp index c346f44..de9b43b 100644 --- a/src/dag/dag-module.cpp +++ b/src/dag/dag-module.cpp @@ -47,7 +47,10 @@ DagModule::getAncestors(EdgeState state) auto parent = getOrConstruct(toStateName(ptr)); // if this is pending, update its descendents if (parent.status == EdgeState::INITIALIZED) { - NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here..."); + NDN_LOG_TRACE(parent.stateName << " is a pending ancestor, stop here...\n" + "Adding " << state.stateName << "into descendants.."); + parent.descendants.insert(state.stateName); + update(parent); } else { // we gonna expand this ptr in the next round. @@ -76,7 +79,10 @@ DagModule::getAncestors(EdgeState state) } if (parent.status == EdgeState::INITIALIZED) { - NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here..."); + NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here...\n" + "Adding " << state.stateName << "into descendants.."); + parent.descendants.insert(state.stateName); + update(parent); } else { nextFrontier.push_back(parent.stateName); @@ -168,6 +174,12 @@ DagModule::onNewRecord(EdgeState& state) if (!state.record.isGenesis()) { evaluateAncestors(state); } + + // resolve all pending descendants + for (auto& desc : state.descendants) { + auto descState = getOrConstruct(desc); + evaluateWaitlist(descState); + } return *this; } diff --git a/src/sync/sync-module.cpp b/src/sync/sync-module.cpp index 8619a1f..e02473b 100644 --- a/src/sync/sync-module.cpp +++ b/src/sync/sync-module.cpp @@ -102,7 +102,8 @@ SyncModule::recursiveFetcher(const NodeID& nid, const SeqNo& s, std::shared_ptr< } acc->clear(); } - }); + }, + MAX_RETRIES); } Name diff --git a/src/sync/sync-module.hpp b/src/sync/sync-module.hpp index 56543bd..42de772 100644 --- a/src/sync/sync-module.hpp +++ b/src/sync/sync-module.hpp @@ -27,6 +27,8 @@ using YieldRecordCallback = std::function; class SyncModule { public: + const ssize_t MAX_RETRIES = 3; + explicit SyncModule(const SyncOptions &options, const SecurityOptions& secOps, ndn::Face& face, storage::Interface storageIntf, const YieldRecordCallback& yield);