diff options
author | Mauro Sardara <msardara@cisco.com> | 2019-02-20 14:32:42 +0100 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2019-03-05 11:42:39 +0100 |
commit | 9d0002e5cb97d939f2f74ab1e635b616d634e7db (patch) | |
tree | 730e4240a637264f859b3b7efeeb8fb83d476f3d /libtransport/src/hicn/transport/core/pending_interest.h | |
parent | 6d7704c1b497341fd6dd3c27e3f64d0db062ccc2 (diff) |
[HICN-73] Performance improvements of interest/data transmission and reception at low level in the stack (portal.h)
Change-Id: I1525726f52040f1609e284bb9b995ea8794c5d5e
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/pending_interest.h')
-rw-r--r-- | libtransport/src/hicn/transport/core/pending_interest.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/libtransport/src/hicn/transport/core/pending_interest.h b/libtransport/src/hicn/transport/core/pending_interest.h index 3b2442d76..c481cc200 100644 --- a/libtransport/src/hicn/transport/core/pending_interest.h +++ b/libtransport/src/hicn/transport/core/pending_interest.h @@ -46,14 +46,15 @@ class PendingInterest { friend class Portal<RawSocketInterface>; public: + using Ptr = utils::ObjectPool<PendingInterest>::Ptr; PendingInterest(); PendingInterest(Interest::Ptr &&interest, std::unique_ptr<asio::steady_timer> &&timer); PendingInterest(Interest::Ptr &&interest, - const OnContentObjectCallback &&on_content_object, - const OnInterestTimeoutCallback &&on_interest_timeout, + OnContentObjectCallback &&on_content_object, + OnInterestTimeoutCallback &&on_interest_timeout, std::unique_ptr<asio::steady_timer> &&timer); ~PendingInterest(); @@ -62,32 +63,28 @@ class PendingInterest { TRANSPORT_ALWAYS_INLINE void startCountdown(Handler &&cb) { timer_->expires_from_now( std::chrono::milliseconds(interest_->getLifetime())); - timer_->async_wait(cb); + timer_->async_wait(std::forward<Handler &&>(cb)); } void cancelTimer(); - void setReceived(); - - bool isReceived() const; - Interest::Ptr &&getInterest(); + void setInterest(Interest::Ptr &&interest); + const OnContentObjectCallback &getOnDataCallback() const; - void setOnDataCallback(const OnContentObjectCallback &on_content_object); + void setOnContentObjectCallback(OnContentObjectCallback &&on_content_object); const OnInterestTimeoutCallback &getOnTimeoutCallback() const; - void setOnTimeoutCallback( - const OnInterestTimeoutCallback &on_interest_timeout); + void setOnTimeoutCallback(OnInterestTimeoutCallback &&on_interest_timeout); private: Interest::Ptr interest_; std::unique_ptr<asio::steady_timer> timer_; OnContentObjectCallback on_content_object_callback_; OnInterestTimeoutCallback on_interest_timeout_callback_; - bool received_; }; } // end namespace core |