diff options
Diffstat (limited to 'libtransport')
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_; |