aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/core/portal.h
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-01-30 12:11:34 +0100
committerAngelo Mantellini <manangel@cisco.com>2019-01-30 15:23:44 +0100
commite5145b878f9de35676085409878a66899d2ee4f2 (patch)
tree177f77810901921ee03d1d3b850600c5f2cd1ef9 /libtransport/src/hicn/transport/core/portal.h
parent30061551cd39c9f30280bfa0cf3cc909f4fac015 (diff)
[HICN-18] first commit of libtransport for windows
Change-Id: I3a43b22194aa13ae5de1746e3d4bd9a275070261 Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/portal.h')
-rw-r--r--libtransport/src/hicn/transport/core/portal.h35
1 files changed, 16 insertions, 19 deletions
diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h
index 58406bbde..0932b56c6 100644
--- a/libtransport/src/hicn/transport/core/portal.h
+++ b/libtransport/src/hicn/transport/core/portal.h
@@ -127,9 +127,7 @@ class Portal {
forwarder_interface_.connect(is_consumer);
}
- ~Portal() {
- stopEventsLoop(true);
- }
+ ~Portal() { stopEventsLoop(true); }
TRANSPORT_ALWAYS_INLINE bool interestIsPending(const Name &name) {
auto it = pending_interest_hash_table_.find(name);
@@ -153,10 +151,10 @@ class Portal {
std::placeholders::_1, name));
}
- TRANSPORT_ALWAYS_INLINE void sendInterest(Interest::Ptr &&interest,
- const OnContentObjectCallback &&on_content_object_callback,
- const OnInterestTimeoutCallback &&on_interest_timeout_callback) {
-
+ TRANSPORT_ALWAYS_INLINE void sendInterest(
+ Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object_callback,
+ const OnInterestTimeoutCallback &&on_interest_timeout_callback) {
const Name name(interest->getName(), true);
// Send it
@@ -168,9 +166,8 @@ class Portal {
std::make_unique<asio::steady_timer>(io_service_));
pending_interest_hash_table_[name]->startCountdown(
- std::bind(&Portal<ForwarderInt>::timerHandler,
- this, std::placeholders::_1, name));
-
+ std::bind(&Portal<ForwarderInt>::timerHandler, this,
+ std::placeholders::_1, name));
}
TRANSPORT_ALWAYS_INLINE void timerHandler(const std::error_code &ec,
@@ -187,9 +184,9 @@ class Portal {
std::unique_ptr<PendingInterest> ptr = std::move(it->second);
pending_interest_hash_table_.erase(it);
- if(ptr->getOnTimeoutCallback() != UNSET_CALLBACK){
- ptr->on_interest_timeout_callback_(std::move(ptr->getInterest()));
- }else if (consumer_callback_) {
+ if (ptr->getOnTimeoutCallback() != UNSET_CALLBACK) {
+ ptr->on_interest_timeout_callback_(std::move(ptr->getInterest()));
+ } else if (consumer_callback_) {
consumer_callback_->onTimeout(std::move(ptr->getInterest()));
}
}
@@ -231,7 +228,7 @@ class Portal {
clear();
- if(kill_connection) {
+ if (kill_connection) {
connector_.close();
}
@@ -310,11 +307,11 @@ class Portal {
interest_ptr->setReceived();
pending_interest_hash_table_.erase(content_object->getName());
- if(interest_ptr->getOnDataCallback() != UNSET_CALLBACK){
- interest_ptr->on_content_object_callback_(
- std::move(interest_ptr->getInterest()),
- std::move(content_object));
- }else if (consumer_callback_) {
+ if (interest_ptr->getOnDataCallback() != UNSET_CALLBACK) {
+ interest_ptr->on_content_object_callback_(
+ std::move(interest_ptr->getInterest()),
+ std::move(content_object));
+ } else if (consumer_callback_) {
consumer_callback_->onContentObject(
std::move(interest_ptr->getInterest()),
std::move(content_object));