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