From 6b94663b2455e212009a544ae23bb6a8c55407f8 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 9 Jun 2022 21:34:09 +0200 Subject: refactor(lib, hicn-light, vpp, hiperf): HICN-723 - move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello --- libtransport/src/core/pending_interest.h | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'libtransport/src/core/pending_interest.h') diff --git a/libtransport/src/core/pending_interest.h b/libtransport/src/core/pending_interest.h index f8a4ba10e..fb10405d3 100644 --- a/libtransport/src/core/pending_interest.h +++ b/libtransport/src/core/pending_interest.h @@ -42,17 +42,9 @@ class PendingInterest { public: using Ptr = utils::ObjectPool::Ptr; - // PendingInterest() - // : interest_(nullptr, nullptr), - // timer_(), - // on_content_object_callback_(), - // on_interest_timeout_callback_() {} PendingInterest(asio::io_service &io_service, const Interest::Ptr &interest) - : interest_(interest), - timer_(io_service), - on_content_object_callback_(), - on_interest_timeout_callback_() {} + : interest_(interest), timer_(io_service) {} PendingInterest(asio::io_service &io_service, const Interest::Ptr &interest, OnContentObjectCallback &&on_content_object, @@ -65,10 +57,9 @@ class PendingInterest { ~PendingInterest() = default; template - TRANSPORT_ALWAYS_INLINE void startCountdown(Handler &&cb) { - timer_.expires_from_now( - std::chrono::milliseconds(interest_->getLifetime())); - timer_.async_wait(std::forward(cb)); + TRANSPORT_ALWAYS_INLINE void startCountdown(uint32_t lifetime, Handler &&cb) { + timer_.expires_from_now(std::chrono::milliseconds(lifetime)); + timer_.async_wait(std::forward(cb)); } TRANSPORT_ALWAYS_INLINE void cancelTimer() { timer_.cancel(); } @@ -77,7 +68,7 @@ class PendingInterest { return std::move(interest_); } - TRANSPORT_ALWAYS_INLINE void setInterest(Interest::Ptr &interest) { + TRANSPORT_ALWAYS_INLINE void setInterest(const Interest::Ptr &interest) { interest_ = interest; } @@ -88,7 +79,7 @@ class PendingInterest { TRANSPORT_ALWAYS_INLINE void setOnContentObjectCallback( OnContentObjectCallback &&on_content_object) { - PendingInterest::on_content_object_callback_ = on_content_object; + PendingInterest::on_content_object_callback_ = std::move(on_content_object); } TRANSPORT_ALWAYS_INLINE const OnInterestTimeoutCallback & @@ -98,7 +89,8 @@ class PendingInterest { TRANSPORT_ALWAYS_INLINE void setOnTimeoutCallback( OnInterestTimeoutCallback &&on_interest_timeout) { - PendingInterest::on_interest_timeout_callback_ = on_interest_timeout; + PendingInterest::on_interest_timeout_callback_ = + std::move(on_interest_timeout); } private: -- cgit 1.2.3-korg