aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/includes
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/includes')
-rw-r--r--libtransport/includes/hicn/transport/core/connector.h33
-rw-r--r--libtransport/includes/hicn/transport/core/endpoint.h4
-rw-r--r--libtransport/includes/hicn/transport/core/interest.h2
-rw-r--r--libtransport/includes/hicn/transport/interfaces/publication_options.h2
-rw-r--r--libtransport/includes/hicn/transport/utils/CMakeLists.txt1
-rw-r--r--libtransport/includes/hicn/transport/utils/move_wrapper.h39
6 files changed, 19 insertions, 62 deletions
diff --git a/libtransport/includes/hicn/transport/core/connector.h b/libtransport/includes/hicn/transport/core/connector.h
index eaf95b2ec..be191fb4a 100644
--- a/libtransport/includes/hicn/transport/core/connector.h
+++ b/libtransport/includes/hicn/transport/core/connector.h
@@ -73,29 +73,26 @@ class Connector : public std::enable_shared_from_this<Connector> {
typename OnReconnect>
Connector(ReceiveCallback &&receive_callback, SentCallback &&packet_sent,
OnClose &&close_callback, OnReconnect &&on_reconnect)
- : receive_callback_(std::forward<ReceiveCallback &&>(receive_callback)),
- sent_callback_(std::forward<SentCallback &&>(packet_sent)),
- on_close_callback_(std::forward<OnClose &&>(close_callback)),
- on_reconnect_callback_(std::forward<OnReconnect &&>(on_reconnect)),
- state_(State::CLOSED),
- connector_id_(invalid_connector),
- connection_reattempts_(0) {}
+ : receive_callback_(std::forward<ReceiveCallback>(receive_callback)),
+ sent_callback_(std::forward<SentCallback>(packet_sent)),
+ on_close_callback_(std::forward<OnClose>(close_callback)),
+ on_reconnect_callback_(std::forward<OnReconnect>(on_reconnect)) {}
virtual ~Connector(){};
template <typename ReceiveCallback>
void setReceiveCallback(ReceiveCallback &&callback) {
- receive_callback_ = std::forward<ReceiveCallback &&>(callback);
+ receive_callback_ = std::forward<ReceiveCallback>(callback);
}
template <typename SentCallback>
void setSentCallback(SentCallback &&callback) {
- sent_callback_ = std::forward<SentCallback &&>(callback);
+ sent_callback_ = std::forward<SentCallback>(callback);
}
template <typename OnClose>
void setOnCloseCallback(OnClose &&callback) {
- on_close_callback_ = std::forward<OnClose &&>(callback);
+ on_close_callback_ = std::forward<OnClose>(callback);
}
template <typename OnReconnect>
@@ -137,24 +134,24 @@ class Connector : public std::enable_shared_from_this<Connector> {
Id getConnectorId() { return connector_id_; }
- void setConnectorName(std::string connector_name) {
+ void setConnectorName(const std::string &connector_name) {
connector_name_ = connector_name;
}
- std::string getConnectorName() { return connector_name_; }
+ std::string getConnectorName() const { return connector_name_; }
template <typename EP>
void setLocalEndpoint(EP &&endpoint) {
local_endpoint_ = std::forward<EP>(endpoint);
}
- Endpoint getLocalEndpoint() { return local_endpoint_; }
+ Endpoint getLocalEndpoint() const { return local_endpoint_; }
- Endpoint getRemoteEndpoint() { return remote_endpoint_; }
+ Endpoint getRemoteEndpoint() const { return remote_endpoint_; }
void setRole(Role r) { role_ = r; }
- Role getRole() { return role_; }
+ Role getRole() const { return role_; }
static utils::MemBuf::Ptr getPacketFromBuffer(uint8_t *buffer,
std::size_t size) {
@@ -213,8 +210,8 @@ class Connector : public std::enable_shared_from_this<Connector> {
OnReconnectCallback on_reconnect_callback_;
// Connector state
- std::atomic<State> state_;
- Id connector_id_;
+ std::atomic<State> state_ = State::CLOSED;
+ Id connector_id_ = invalid_connector;
// Endpoints
Endpoint local_endpoint_;
@@ -230,7 +227,7 @@ class Connector : public std::enable_shared_from_this<Connector> {
AtomicConnectorStats stats_;
// Connection attempts
- std::uint32_t connection_reattempts_;
+ std::uint32_t connection_reattempts_ = 0;
};
} // namespace core
diff --git a/libtransport/includes/hicn/transport/core/endpoint.h b/libtransport/includes/hicn/transport/core/endpoint.h
index e1fa193d7..2278a1759 100644
--- a/libtransport/includes/hicn/transport/core/endpoint.h
+++ b/libtransport/includes/hicn/transport/core/endpoint.h
@@ -62,8 +62,8 @@ class Endpoint {
#if 0
template <typename Ip, typename Port>
Endpoint(Ip &&ip_address, Port &&port)
- : address_(std::forward<Ip &&>(ip_address)),
- port_(std::forward<Port &&>(port)) {}
+ : address_(std::forward<Ip>(ip_address)),
+ port_(std::forward<Port>(port)) {}
#endif
asio::ip::address getAddress() { return address_; }
diff --git a/libtransport/includes/hicn/transport/core/interest.h b/libtransport/includes/hicn/transport/core/interest.h
index 428829697..59da5b91f 100644
--- a/libtransport/includes/hicn/transport/core/interest.h
+++ b/libtransport/includes/hicn/transport/core/interest.h
@@ -88,7 +88,7 @@ class Interest
uint32_t getLifetime() const override;
- bool hasManifest();
+ bool hasManifest() const;
void appendSuffix(std::uint32_t suffix);
diff --git a/libtransport/includes/hicn/transport/interfaces/publication_options.h b/libtransport/includes/hicn/transport/interfaces/publication_options.h
index 03a0763f5..f4f409d00 100644
--- a/libtransport/includes/hicn/transport/interfaces/publication_options.h
+++ b/libtransport/includes/hicn/transport/interfaces/publication_options.h
@@ -25,7 +25,7 @@ class PublicationOptions {
public:
template <typename T>
PublicationOptions(T&& name, uint32_t lifetime)
- : name_(std::forward<T&&>(name)),
+ : name_(std::forward<T>(name)),
content_lifetime_milliseconds_(lifetime) {}
TRANSPORT_ALWAYS_INLINE const core::Name& getName() const { return name_; }
diff --git a/libtransport/includes/hicn/transport/utils/CMakeLists.txt b/libtransport/includes/hicn/transport/utils/CMakeLists.txt
index bbd149e09..1dba94451 100644
--- a/libtransport/includes/hicn/transport/utils/CMakeLists.txt
+++ b/libtransport/includes/hicn/transport/utils/CMakeLists.txt
@@ -32,7 +32,6 @@ list(APPEND HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/string_utils.h
${CMAKE_CURRENT_SOURCE_DIR}/file.h
${CMAKE_CURRENT_SOURCE_DIR}/shared_ptr_utils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/move_wrapper.h
${CMAKE_CURRENT_SOURCE_DIR}/noncopyable.h
${CMAKE_CURRENT_SOURCE_DIR}/singleton.h
)
diff --git a/libtransport/includes/hicn/transport/utils/move_wrapper.h b/libtransport/includes/hicn/transport/utils/move_wrapper.h
deleted file mode 100644
index 73389948d..000000000
--- a/libtransport/includes/hicn/transport/utils/move_wrapper.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <type_traits>
-
-namespace utils {
-
-template <typename F>
-struct MoveWrapper : F {
- MoveWrapper(F&& f) : F(std::move(f)) {}
- ~MoveWrapper() = default;
-
- MoveWrapper(MoveWrapper&&) = default;
- MoveWrapper& operator=(MoveWrapper&&) = default;
-
- MoveWrapper(const MoveWrapper&);
- MoveWrapper& operator=(const MoveWrapper&);
-};
-
-template <typename T>
-auto moveHandler(T&& t) -> MoveWrapper<typename std::decay<T>::type> {
- return std::move(t);
-}
-} // namespace utils \ No newline at end of file