From 0b9bac5f0b3883803b86836fa4c044c8b788ef7b Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Thu, 6 Feb 2020 16:48:38 +0100 Subject: [PATCH] Refs #7478. Creating send buffers after receiver resources. --- .../rtps/participant/RTPSParticipantImpl.cpp | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index a56209010fd..77b6d81c0cd 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -264,19 +264,6 @@ RTPSParticipantImpl::RTPSParticipantImpl( m_att.defaultMulticastLocatorList.clear(); } - bool allow_growing_buffers = m_att.allocation.send_buffers.dynamic; - size_t num_send_buffers = m_att.allocation.send_buffers.preallocated_number; - if (num_send_buffers == 0) - { - // Three buffers (user, events and async writer threads) - num_send_buffers = 3; - // Add one buffer per reception thread - num_send_buffers += m_receiverResourcelist.size(); - } - - // Create buffer pool - send_buffers_.reset(new SendBuffersManager(num_send_buffers, allow_growing_buffers)); - #if HAVE_SECURITY // Start security // TODO(Ricardo) Get returned value in future. @@ -295,7 +282,18 @@ RTPSParticipantImpl::RTPSParticipantImpl( createReceiverResources(m_att.defaultUnicastLocatorList, true, false); createReceiverResources(m_att.defaultMulticastLocatorList, true, false); - // Allocate all pending send buffers + bool allow_growing_buffers = m_att.allocation.send_buffers.dynamic; + size_t num_send_buffers = m_att.allocation.send_buffers.preallocated_number; + if (num_send_buffers == 0) + { + // Three buffers (user, events and async writer threads) + num_send_buffers = 3; + // Add one buffer per reception thread + num_send_buffers += m_receiverResourcelist.size(); + } + + // Create buffer pool + send_buffers_.reset(new SendBuffersManager(num_send_buffers, allow_growing_buffers)); send_buffers_->init(this); #if HAVE_SECURITY