From e809408ae3eac990cf0e45c60b085e23aaaddc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Thu, 5 Dec 2024 12:17:42 +0100 Subject: [PATCH 1/2] Refs #22439. Fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- src/cpp/rtps/messages/RTPSMessageGroup.cpp | 8 +++++++- src/cpp/rtps/transport/UDPTransportInterface.cpp | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index e3752a8fda2..7bc257c96d3 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -34,6 +34,12 @@ #include +#ifdef FASTDDS_STATISTICS +const size_t max_boost_buffers = 61; // ... + SubMsg header + SubMsg body + Statistics message +#else +const size_t max_boost_buffers = 62; // ... + SubMsg header + SubMsg body +#endif // ifdef FASTDDS_STATISTICS + namespace eprosima { namespace fastdds { namespace rtps { @@ -455,7 +461,7 @@ bool RTPSMessageGroup::insert_submessage( } // Messages with a submessage bigger than 64KB cannot have more submessages and should be flushed - if (is_big_submessage) + if (is_big_submessage || max_boost_buffers < buffers_to_send_->size()) { flush(); } diff --git a/src/cpp/rtps/transport/UDPTransportInterface.cpp b/src/cpp/rtps/transport/UDPTransportInterface.cpp index 95105eeb855..5cdfbd47986 100644 --- a/src/cpp/rtps/transport/UDPTransportInterface.cpp +++ b/src/cpp/rtps/transport/UDPTransportInterface.cpp @@ -592,6 +592,11 @@ bool UDPTransportInterface::send( EPROSIMA_LOG_WARNING(TRANSPORT_UDP, ec.message()); return false; } + + if (bytesSent != total_bytes) + { + EPROSIMA_LOG_WARNING(TRANSPORT_UDP, "boost send_to wasn't send all bytes"); + } } catch (const std::exception& error) { From 0a70d0411ac3f9b27d346ddf273a18ad67845032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Thu, 5 Dec 2024 12:48:24 +0100 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Ferreira González --- src/cpp/rtps/messages/RTPSMessageGroup.cpp | 2 +- src/cpp/rtps/transport/UDPTransportInterface.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index 7bc257c96d3..8df52318643 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -460,7 +460,7 @@ bool RTPSMessageGroup::insert_submessage( return false; } - // Messages with a submessage bigger than 64KB cannot have more submessages and should be flushed + // Flush when the submessage is bigger than 64KB OR if the number of buffers to send is 64 (boost limit) if (is_big_submessage || max_boost_buffers < buffers_to_send_->size()) { flush(); diff --git a/src/cpp/rtps/transport/UDPTransportInterface.cpp b/src/cpp/rtps/transport/UDPTransportInterface.cpp index 5cdfbd47986..cd9b11e48d4 100644 --- a/src/cpp/rtps/transport/UDPTransportInterface.cpp +++ b/src/cpp/rtps/transport/UDPTransportInterface.cpp @@ -595,7 +595,7 @@ bool UDPTransportInterface::send( if (bytesSent != total_bytes) { - EPROSIMA_LOG_WARNING(TRANSPORT_UDP, "boost send_to wasn't send all bytes"); + EPROSIMA_LOG_WARNING(TRANSPORT_UDP, "Boost send_to wasn't able to send all bytes"); } } catch (const std::exception& error)