summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-08 17:27:22 +0100
committerMauro Sardara <msardara@cisco.com>2019-03-18 17:31:50 +0000
commita1166569e347d43e709fbfa5abbe534a5cc9fb76 (patch)
tree6c7920b4018a952b217b4339632fcf8be2238cf9
parentbb563a76bd1b258534ee19be98dfee735908ea22 (diff)
[HICN-103] Manifest retransmissions.
Change-Id: I1b61c79e99bb8da471d1e284ea2a629d48b9f308 Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_producer.cc4
-rw-r--r--libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc35
-rw-r--r--libtransport/src/hicn/transport/protocols/manifest_indexing_manager.h4
3 files changed, 41 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.cc b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
index d89fc9367..7a513349d 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
@@ -300,6 +300,10 @@ uint32_t ProducerSocket::produce(Name content_name, const uint8_t *buf,
manifest->setFinalManifest(is_last_manifest);
}
+ if (!is_last) {
+ manifest->addSuffixHash(current_segment, *zero_hash);
+ }
+
manifest->encode();
identity_->getSigner().sign(*manifest);
passContentObjectToCallbacks(manifest);
diff --git a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
index 2d7d8de3e..cfefe46a1 100644
--- a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
+++ b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc
@@ -123,8 +123,13 @@ bool ManifestIndexManager::onManifest(
interest->setLifetime(interest_lifetime);
// Send requests for manifest out of the congestion window (no
- // in_flight_interest++)
- portal->sendInterest(std::move(interest));
+ // in_flight_interests++)
+ portal->sendInterest(
+ std::move(interest),
+ std::bind(&ManifestIndexManager::onManifestReceived, this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(&ManifestIndexManager::onManifestTimeout, this,
+ std::placeholders::_1));
} while (segment_count < current_window_size &&
next_manifest_ < final_suffix_);
@@ -142,6 +147,32 @@ bool ManifestIndexManager::onManifest(
return manifest_verified;
}
+void ManifestIndexManager::onManifestReceived(Interest::Ptr &&i, ContentObject::Ptr &&c) {
+ onManifest(std::move(c));
+}
+
+void ManifestIndexManager::onManifestTimeout(Interest::Ptr &&i) {
+ const Name &n = i->getName();
+ uint32_t segment = n.getSuffix();
+
+ if (segment > final_suffix_) {
+ return;
+ }
+
+ // Get portal
+ std::shared_ptr<interface::BasePortal> portal;
+ socket_->getSocketOption(GeneralTransportOptions::PORTAL, portal);
+
+ // Send requests for manifest out of the congestion window (no
+ // in_flight_interests++)
+ portal->sendInterest(
+ std::move(i),
+ std::bind(&ManifestIndexManager::onManifestReceived, this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(&ManifestIndexManager::onManifestTimeout, this,
+ std::placeholders::_1));
+}
+
bool ManifestIndexManager::onContentObject(
const core::ContentObject &content_object) {
bool verify_signature;
diff --git a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.h b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.h
index ee2c531c7..5e1baa09c 100644
--- a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.h
+++ b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.h
@@ -50,6 +50,10 @@ class ManifestIndexManager : public IncrementalIndexManager,
uint32_t getFinalSuffix() override;
+ private:
+ void onManifestReceived(Interest::Ptr &&i, ContentObject::Ptr &&c);
+ void onManifestTimeout(Interest::Ptr &&i);
+
protected:
SuffixQueue suffix_queue_;
SuffixQueue::iterator next_reassembly_segment_;