summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/core/memif_connector.cc3
-rw-r--r--libtransport/src/hicn/transport/core/name.cc2
-rw-r--r--libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc19
-rw-r--r--libtransport/src/hicn/transport/utils/epoll_event_reactor.h3
4 files changed, 14 insertions, 13 deletions
diff --git a/libtransport/src/hicn/transport/core/memif_connector.cc b/libtransport/src/hicn/transport/core/memif_connector.cc
index 0a2affb8a..a4756d136 100644
--- a/libtransport/src/hicn/transport/core/memif_connector.cc
+++ b/libtransport/src/hicn/transport/core/memif_connector.cc
@@ -136,8 +136,7 @@ int MemifConnector::createMemif(uint32_t index, uint8_t mode, char *s) {
args.buffer_size = MEMIF_BUF_SIZE;
args.num_s2m_rings = 1;
args.num_m2s_rings = 1;
- strncpy((char *)args.interface_name, IF_NAME, strlen(IF_NAME));
- // strncpy((char *) args.instance_name, APP_NAME, strlen(APP_NAME));
+ strncpy((char *)args.interface_name, IF_NAME, strlen(IF_NAME) + 1);
args.mode = memif_interface_mode_t::MEMIF_INTERFACE_MODE_IP;
args.socket_filename = (uint8_t *)socket_filename_.c_str();
diff --git a/libtransport/src/hicn/transport/core/name.cc b/libtransport/src/hicn/transport/core/name.cc
index ba3e9e825..867d3a755 100644
--- a/libtransport/src/hicn/transport/core/name.cc
+++ b/libtransport/src/hicn/transport/core/name.cc
@@ -67,7 +67,7 @@ Name::Name(const std::string &uri) {
try {
seq_number = tokenizer.nextToken();
- } catch (errors::TokenizerException) {
+ } catch (errors::TokenizerException &) {
seq_number = "0";
}
diff --git a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
index 8dc607295..0d622f9a3 100644
--- a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
+++ b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
@@ -208,20 +208,21 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
}
void VPPForwarderInterface::closeConnection() {
- if (sw_if_index_ != uint32_t(~0) && VPPForwarderInterface::memif_api_) {
- int ret = memif_binary_api_delete_memif(VPPForwarderInterface::memif_api_,
- sw_if_index_);
+ if (VPPForwarderInterface::api_) {
+ if (sw_if_index_ != uint32_t(~0)) {
+ int ret = memif_binary_api_delete_memif(VPPForwarderInterface::memif_api_,
+ sw_if_index_);
- if (ret < 0) {
- TRANSPORT_LOGE("Error deleting memif with sw idx %u.", sw_if_index_);
+ if (ret < 0) {
+ TRANSPORT_LOGE("Error deleting memif with sw idx %u.", sw_if_index_);
+ }
}
- }
- if (VPPForwarderInterface::api_) {
vpp_binary_api_destroy(VPPForwarderInterface::api_);
- }
+ connector_.close();
- connector_.close();
+ VPPForwarderInterface::api_ = nullptr;
+ }
}
} // namespace core
diff --git a/libtransport/src/hicn/transport/utils/epoll_event_reactor.h b/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
index bb4db3ee7..dbb87c6c5 100644
--- a/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
+++ b/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
@@ -18,6 +18,7 @@
#include <hicn/transport/utils/event_reactor.h>
#include <sys/epoll.h>
+#include <atomic>
#include <cstddef>
#include <functional>
#include <mutex>
@@ -57,7 +58,7 @@ class EpollEventReactor : public EventReactor {
int addFileDescriptor(int fd, uint32_t events);
int epoll_fd_;
- volatile bool run_event_loop_;
+ std::atomic_bool run_event_loop_;
EventCallbackMap event_callback_map_;
std::mutex event_callback_map_mutex_;
};