diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index e3752a8fda2..8df52318643 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 { @@ -454,8 +460,8 @@ bool RTPSMessageGroup::insert_submessage( return false; } - // Messages with a submessage bigger than 64KB cannot have more submessages and should be flushed - if (is_big_submessage) + // 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 95105eeb855..cd9b11e48d4 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 able to send all bytes"); + } } catch (const std::exception& error) {