From e25b10e6c0e55e5d0a894fb7269dcbff4dfcd2ab Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 23 Aug 2022 07:58:21 +0200 Subject: [PATCH 1/4] Fix default QoS in Requester and Replier (#313) Signed-off-by: Pablo Garrido Signed-off-by: Pablo Garrido --- src/cpp/middleware/fastdds/FastDDSMiddleware.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpp/middleware/fastdds/FastDDSMiddleware.cpp b/src/cpp/middleware/fastdds/FastDDSMiddleware.cpp index 6e958b9f..30a41373 100644 --- a/src/cpp/middleware/fastdds/FastDDSMiddleware.cpp +++ b/src/cpp/middleware/fastdds/FastDDSMiddleware.cpp @@ -568,6 +568,7 @@ bool FastDDSMiddleware::create_requester_by_bin( attrs.publisher.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; attrs.subscriber.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; + attrs.subscriber.qos.m_reliability.kind = fastdds::dds::RELIABLE_RELIABILITY_QOS; std::shared_ptr requester = create_requester(participant, attrs); if (nullptr == requester) @@ -699,6 +700,7 @@ bool FastDDSMiddleware::create_replier_by_bin( attrs.publisher.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; attrs.subscriber.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; + attrs.subscriber.qos.m_reliability.kind = fastdds::dds::RELIABLE_RELIABILITY_QOS; std::shared_ptr replier = create_replier(participant, attrs); if (nullptr == replier) From 1eabc1ef5a932eeace93e13a544d2d697d61b51a Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Mon, 5 Sep 2022 13:03:22 +0200 Subject: [PATCH 2/4] Fix exception on Heartbeat filter (#314) Signed-off-by: Pablo Garrido Signed-off-by: Pablo Garrido --- include/uxr/agent/message/InputMessage.hpp | 19 ++++++++++++++++--- src/cpp/transport/Server.cpp | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/uxr/agent/message/InputMessage.hpp b/include/uxr/agent/message/InputMessage.hpp index 73b5184d..8533fdb9 100644 --- a/include/uxr/agent/message/InputMessage.hpp +++ b/include/uxr/agent/message/InputMessage.hpp @@ -38,7 +38,10 @@ class InputMessage deserializer_(fastbuffer_) { memcpy(buf_, buf, len); - deserialize(header_); + + // A valid XRCE message must have a valid header and at least 1 submessage + valid_xrce_message_ = deserialize(header_); + valid_xrce_message_ = valid_xrce_message_ && count_submessages() > 0; } uint8_t* get_buf() const { return buf_; } @@ -70,6 +73,8 @@ class InputMessage size_t count_submessages(); + bool is_valid_xrce_message() { return valid_xrce_message_; } + dds::xrce::SubmessageId get_submessage_id(); private: @@ -85,6 +90,7 @@ class InputMessage dds::xrce::SubmessageHeader subheader_; fastcdr::FastBuffer fastbuffer_; fastcdr::Cdr deserializer_; + bool valid_xrce_message_ = false; }; inline bool InputMessage::prepare_next_submessage() @@ -114,8 +120,15 @@ inline size_t InputMessage::count_submessages() local_deserializer.jump((4 - ((local_deserializer.getCurrentPosition() - local_deserializer.getBufferPointer()) & 3)) & 3); if (fastbuffer_.getBufferSize() > local_deserializer.getSerializedDataLength()) { - local_subheader.deserialize(local_deserializer); - count++; + try + { + local_subheader.deserialize(local_deserializer); + count++; + } + catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + rv = false; + } } else { rv = false; } diff --git a/src/cpp/transport/Server.cpp b/src/cpp/transport/Server.cpp index b07b3c50..f9b2a314 100644 --- a/src/cpp/transport/Server.cpp +++ b/src/cpp/transport/Server.cpp @@ -192,7 +192,7 @@ void Server::receiver_loop() TransportRc transport_rc = TransportRc::ok; if (recv_message(input_packet, RECEIVE_TIMEOUT, transport_rc)) { - if(dds::xrce::HEARTBEAT == input_packet.message->get_submessage_id() && 1U == input_packet.message->count_submessages()){ + if(input_packet.message->is_valid_xrce_message() && 1U == input_packet.message->count_submessages() && dds::xrce::HEARTBEAT == input_packet.message->get_submessage_id()){ input_scheduler_.push(std::move(input_packet), 1); } else From 12f794e2e3025b40b3e859f3a9f00cb064de5ab9 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Wed, 28 Sep 2022 14:16:31 +0200 Subject: [PATCH 3/4] Bump Fast DDS and Fast CDR (#315) * Bump Fast DDS and Fast CDR Signed-off-by: Pablo Garrido * Apply suggestions from code review * Fix only the minor version Signed-off-by: Pablo Garrido Signed-off-by: Pablo Garrido --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47606952..a3b48983 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,8 +80,8 @@ set(_deps "") if(UAGENT_USE_SYSTEM_FASTCDR) set(_fastcdr_version 1) else() - set(_fastcdr_version 1.0.22) - set(_fastcdr_tag v1.0.22) + set(_fastcdr_version 1.0.24) + set(_fastcdr_tag v1.0.24) endif() list(APPEND _deps "fastcdr\;${_fastcdr_version}") @@ -95,8 +95,8 @@ if(UAGENT_FAST_PROFILE) if(UAGENT_USE_SYSTEM_FASTDDS) set(_fastdds_version 2) else() - set(_fastdds_version 2.4.1) - set(_fastdds_tag v2.4.1) + set(_fastdds_version 2.8) + set(_fastdds_tag 2.8.x) set(_foonathan_memory_tag v0.7-1) # This tag should be updated every time it gets updated in foonathan_memory_vendor eProsima's package endif() list(APPEND _deps "fastrtps\;${_fastdds_version}") From a0bc8c732e78d8357c959100f97c38117eaf52a3 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Wed, 28 Sep 2022 14:18:37 +0200 Subject: [PATCH 4/4] Bump version Signed-off-by: Pablo Garrido --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3b48983..39c920ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,8 @@ option(UAGENT_SECURITY_PROFILE "Build security profile." OFF) option(UAGENT_BUILD_EXECUTABLE "Build Micro XRCE-DDS Agent provided executable." ON) option(UAGENT_BUILD_USAGE_EXAMPLES "Build Micro XRCE-DDS Agent built-in usage examples" OFF) -set(UAGENT_P2P_CLIENT_VERSION 2.2.0 CACHE STRING "Sets Micro XRCE-DDS client version for P2P") -set(UAGENT_P2P_CLIENT_TAG v2.2.0 CACHE STRING "Sets Micro XRCE-DDS client tag for P2P") +set(UAGENT_P2P_CLIENT_VERSION 2.2.1 CACHE STRING "Sets Micro XRCE-DDS client version for P2P") +set(UAGENT_P2P_CLIENT_TAG v2.2.1 CACHE STRING "Sets Micro XRCE-DDS client tag for P2P") option(UAGENT_BUILD_CI_TESTS "Build CI test cases.") if(UAGENT_BUILD_CI_TESTS) @@ -117,7 +117,7 @@ endif() ############################################################################### set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) if(NOT UAGENT_SUPERBUILD) - project(microxrcedds_agent VERSION "2.2.0" LANGUAGES C CXX) + project(microxrcedds_agent VERSION "2.2.1" LANGUAGES C CXX) else() project(uagent_superbuild NONE) include(${PROJECT_SOURCE_DIR}/cmake/SuperBuild.cmake)