Add advisory "incomingFaceId" to missing data notifications
Change-Id: Ida1acdc7c86d1110a8586d4a396301b89c37229b
Refs: #3626
diff --git a/PSync/common.hpp b/PSync/common.hpp
index aee210a..ea38f40 100644
--- a/PSync/common.hpp
+++ b/PSync/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis
+ * Copyright (c) 2014-2022, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -65,6 +65,7 @@
ndn::Name prefix;
uint64_t lowSeq;
uint64_t highSeq;
+ uint64_t incomingFace;
};
using UpdateCallback = std::function<void(const std::vector<MissingDataInfo>&)>;
diff --git a/PSync/consumer.cpp b/PSync/consumer.cpp
index 6c77ed3..a55860b 100644
--- a/PSync/consumer.cpp
+++ b/PSync/consumer.cpp
@@ -63,7 +63,7 @@
m_bloomFilter.insert(prefix);
if (callSyncDataCb && seqNo != 0) {
- m_onUpdate({{prefix, seqNo, seqNo}});
+ m_onUpdate({{prefix, seqNo, seqNo, 0}});
}
return true;
@@ -145,7 +145,7 @@
// m_prefixes (see addSubscription). So [] operator is safe to use.
if (isSubscribed(prefix) && seq > m_prefixes[prefix]) {
// In case we are behind on this prefix and consumer is subscribed to it
- updates.push_back({prefix, m_prefixes[prefix] + 1, seq});
+ updates.push_back({prefix, m_prefixes[prefix] + 1, seq, 0});
m_prefixes[prefix] = seq;
}
availableSubscriptions.emplace(prefix, seq);
@@ -240,7 +240,7 @@
if (m_prefixes.find(prefix) == m_prefixes.end() || seq > m_prefixes[prefix]) {
// If this is just the next seq number then we had already informed the consumer about
// the previous sequence number and hence seq low and seq high should be equal to current seq
- updates.push_back({prefix, m_prefixes[prefix] + 1, seq});
+ updates.push_back({prefix, m_prefixes[prefix] + 1, seq, 0});
m_prefixes[prefix] = seq;
}
// Else updates will be empty and consumer will not be notified.
diff --git a/PSync/full-producer.cpp b/PSync/full-producer.cpp
index 8e62a22..70e7a52 100644
--- a/PSync/full-producer.cpp
+++ b/PSync/full-producer.cpp
@@ -24,6 +24,7 @@
#include <ndn-cxx/security/validator-null.hpp>
#include <ndn-cxx/util/logger.hpp>
#include <ndn-cxx/util/segment-fetcher.hpp>
+#include <ndn-cxx/lp/tags.hpp>
#include <cstring>
@@ -117,6 +118,16 @@
onSyncData(syncInterest, bufferPtr);
});
+ m_fetcher->afterSegmentValidated.connect([this] (const ndn::Data& data) {
+ auto tag = data.getTag<ndn::lp::IncomingFaceIdTag>();
+ if (tag) {
+ m_incomingFace = *tag;
+ }
+ else {
+ m_incomingFace = 0;
+ }
+ });
+
m_fetcher->onError.connect([this] (uint32_t errorCode, const std::string& msg) {
NDN_LOG_ERROR("Cannot fetch sync data, error: " << errorCode << ", message: " << msg);
// We would like to recover from errors like NoRoute NACK quicker than sync Interest timeout.
@@ -295,7 +306,7 @@
uint64_t seq = content.get(content.size() - 1).toNumber();
if (m_prefixes.find(prefix) == m_prefixes.end() || m_prefixes[prefix] < seq) {
- updates.push_back({prefix, m_prefixes[prefix] + 1, seq});
+ updates.push_back({prefix, m_prefixes[prefix] + 1, seq, m_incomingFace});
updateSeqNo(prefix, seq);
// We should not call satisfyPendingSyncInterests here because we just
// got data and deleted pending interest by calling deletePendingFullSyncInterests
diff --git a/PSync/full-producer.hpp b/PSync/full-producer.hpp
index aea5bcb..53d09b5 100644
--- a/PSync/full-producer.hpp
+++ b/PSync/full-producer.hpp
@@ -188,6 +188,7 @@
ndn::Name m_outstandingInterestName;
ndn::ScopedRegisteredPrefixHandle m_registeredPrefix;
std::shared_ptr<ndn::util::SegmentFetcher> m_fetcher;
+ uint64_t m_incomingFace = 0;
};
} // namespace psync