summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/higet/CMakeLists.txt5
-rw-r--r--apps/http-proxy/CMakeLists.txt5
-rw-r--r--apps/http-proxy/src/IcnReceiver.cc39
-rw-r--r--apps/http-proxy/src/IcnReceiver.h11
-rw-r--r--apps/http-server/CMakeLists.txt5
-rw-r--r--hicn-plugin/src/data_push_node.c2
-rw-r--r--hicn-plugin/src/pcs.h8
-rw-r--r--utils/CMakeLists.txt5
8 files changed, 69 insertions, 11 deletions
diff --git a/apps/higet/CMakeLists.txt b/apps/higet/CMakeLists.txt
index 8c7188c49..747760f00 100644
--- a/apps/higet/CMakeLists.txt
+++ b/apps/higet/CMakeLists.txt
@@ -22,6 +22,11 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
+if (NOT CMAKE_BUILD_TYPE)
+ message(STATUS "No build type selected, default to Release")
+ set(CMAKE_BUILD_TYPE "Release")
+endif ()
+
list(APPEND APPS_SRC
higet.cc
)
diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt
index 010a2c2b6..85c044d58 100644
--- a/apps/http-proxy/CMakeLists.txt
+++ b/apps/http-proxy/CMakeLists.txt
@@ -19,6 +19,11 @@ set(CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake/Modules/"
)
+if (NOT CMAKE_BUILD_TYPE)
+ message(STATUS "No build type selected, default to Release")
+ set(CMAKE_BUILD_TYPE "Release")
+endif ()
+
find_package(Threads REQUIRED)
include_directories(
SYSTEM
diff --git a/apps/http-proxy/src/IcnReceiver.cc b/apps/http-proxy/src/IcnReceiver.cc
index fc6837a2c..d4e922c11 100644
--- a/apps/http-proxy/src/IcnReceiver.cc
+++ b/apps/http-proxy/src/IcnReceiver.cc
@@ -126,20 +126,37 @@ void AsyncConsumerProducer::doReceive() {
void AsyncConsumerProducer::manageIncomingInterest(
core::Name& name, core::Packet::MemBufPtr& packet, utils::MemBuf* payload) {
- // auto seg = name.getSuffix();
+ auto seg = name.getSuffix();
name.setSuffix(0);
auto _it = chunk_number_map_.find(name);
auto _end = chunk_number_map_.end();
if (_it != _end) {
- return;
+ if (_it->second.second) {
+ // Content is in production
+ return;
+ }
+
+ if (seg >= _it->second.first) {
+ TRANSPORT_LOGD(
+ "Ignoring interest with name %s for a content object which does not "
+ "exist. (Request: %u, max: %u)",
+ name.toString().c_str(), (uint32_t)seg, (uint32_t)_it->second.first);
+ return;
+ }
}
bool is_mpd =
HTTPMessageFastParser::isMpdRequest(payload->data(), payload->length());
- chunk_number_map_.emplace(name, 0);
- response_name_queue_.emplace(std::move(name), is_mpd ? 1000 : 10000);
+ auto pair = chunk_number_map_.emplace(name, std::pair<uint32_t, bool>(0, 0));
+ if (!pair.second) {
+ pair.first->second.first = 0;
+ }
+
+ pair.first->second.second = true;
+
+ response_name_queue_.emplace(std::move(name), is_mpd ? 1000 : 100000);
connector_.send(payload, [packet = std::move(packet)]() {});
}
@@ -166,17 +183,23 @@ void AsyncConsumerProducer::publishContent(const uint8_t* data,
const interface::Name& name = options.getName();
- start_suffix = chunk_number_map_[name];
+ auto it = chunk_number_map_.find(name);
+ if (it == chunk_number_map_.end()) {
+ std::cerr << "Aborting due to response not found in ResposeInfo map."
+ << std::endl;
+ abort();
+ }
+
+ start_suffix = it->second.first;
if (headers) {
request_counter_++;
}
-
- chunk_number_map_[name] +=
+ it->second.first +=
producer_socket_.produce(name, data, size, is_last, start_suffix);
if (is_last) {
- chunk_number_map_.erase(name);
+ it->second.second = false;
response_name_queue_.pop();
}
}
diff --git a/apps/http-proxy/src/IcnReceiver.h b/apps/http-proxy/src/IcnReceiver.h
index 61ca4333a..ea4eeb010 100644
--- a/apps/http-proxy/src/IcnReceiver.h
+++ b/apps/http-proxy/src/IcnReceiver.h
@@ -28,6 +28,10 @@
namespace transport {
class AsyncConsumerProducer {
+ using SegmentProductionPair = std::pair<uint32_t, bool>;
+ using ResponseInfoMap = std::unordered_map<core::Name, SegmentProductionPair>;
+ using RequestQueue = std::queue<interface::PublicationOptions>;
+
public:
explicit AsyncConsumerProducer(const std::string& prefix,
std::string& ip_address, std::string& port,
@@ -63,8 +67,11 @@ class AsyncConsumerProducer {
// std::unordered_map<core::Name, std::shared_ptr<ATSConnector>>
// connection_map_;
ATSConnector connector_;
- std::unordered_map<core::Name, uint32_t> chunk_number_map_;
- std::queue<interface::PublicationOptions> response_name_queue_;
+
+ // ResponseInfoMap --> max_seq_number + bool indicating whether request is in
+ // production
+ ResponseInfoMap chunk_number_map_;
+ RequestQueue response_name_queue_;
};
} // namespace transport
diff --git a/apps/http-server/CMakeLists.txt b/apps/http-server/CMakeLists.txt
index 65dcc9a98..743176136 100644
--- a/apps/http-server/CMakeLists.txt
+++ b/apps/http-server/CMakeLists.txt
@@ -20,6 +20,11 @@ list(APPEND LIBRARIES
${CURL_LIBRARY}
)
+if (NOT CMAKE_BUILD_TYPE)
+ message(STATUS "No build type selected, default to Release")
+ set(CMAKE_BUILD_TYPE "Release")
+endif ()
+
set(LIB_SOURCE_FILES
http-server/http_server.cc
http-server/response.cc
diff --git a/hicn-plugin/src/data_push_node.c b/hicn-plugin/src/data_push_node.c
index 8f9e137f7..8f9ecbb8e 100644
--- a/hicn-plugin/src/data_push_node.c
+++ b/hicn-plugin/src/data_push_node.c
@@ -128,7 +128,7 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
}
pitp = hicn_pit_get_data (nodep);
- hicn_pit_init_data (pitp);
+ hicn_cs_init_data (pitp);
pitp->shared.create_time = tnow;
if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index f87cccf8a..b9b40a3fb 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -256,6 +256,14 @@ hicn_pit_init_data (hicn_pcs_entry_t * p)
p->u.pit.faces.next_bucket = face_bkt - hicn_face_bucket_pool;
}
+/* Init pit/cs data block (usually inside hash table node) */
+static inline void
+hicn_cs_init_data (hicn_pcs_entry_t * p)
+{
+ p->shared.entry_flags = 0;
+ p->u.pit.faces.n_faces = 0;
+ p->u.pit.faces.is_overflow = 0;
+}
static inline f64
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index c78110949..2f7b3bb12 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -22,6 +22,11 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
+if (NOT CMAKE_BUILD_TYPE)
+ message(STATUS "No build type selected, default to Release")
+ set(CMAKE_BUILD_TYPE "Release")
+endif ()
+
include(BuildMacros)
include(WindowsMacros)