diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-03-18 18:23:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-03-18 18:23:54 +0000 |
commit | 7266728a7857b038679fe35321ace30386f0c461 (patch) | |
tree | 7c568f1059c0550b20f2787983bae22ee13d409b /libtransport/src | |
parent | 60f96c0ede769bf4da2ce02cc7aaf8aaa613be36 (diff) | |
parent | a1166569e347d43e709fbfa5abbe534a5cc9fb76 (diff) |
Merge "[HICN-103] Manifest retransmissions."
Diffstat (limited to 'libtransport/src')
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_; |