diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 48f00d6a449..07f8d108e67 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -353,10 +353,10 @@ RTPSParticipantImpl::RTPSParticipantImpl( m_att.defaultMulticastLocatorList.clear(); } - createReceiverResources(m_att.builtin.metatrafficMulticastLocatorList, true, false); - createReceiverResources(m_att.builtin.metatrafficUnicastLocatorList, true, false); - createReceiverResources(m_att.defaultUnicastLocatorList, true, false); - createReceiverResources(m_att.defaultMulticastLocatorList, true, false); + createReceiverResources(m_att.builtin.metatrafficMulticastLocatorList, true, false, true); + createReceiverResources(m_att.builtin.metatrafficUnicastLocatorList, true, false, true); + createReceiverResources(m_att.defaultUnicastLocatorList, true, false, true); + createReceiverResources(m_att.defaultMulticastLocatorList, true, false, true); namespace ExternalLocatorsProcessor = fastdds::rtps::ExternalLocatorsProcessor; ExternalLocatorsProcessor::set_listening_locators(m_att.builtin.metatraffic_external_unicast_locators, @@ -1567,7 +1567,7 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint( } // Try creating receiver resources - if (createReceiverResources(attributes.unicastLocatorList, false, true)) + if (createReceiverResources(attributes.unicastLocatorList, false, true, false)) { break; } @@ -1596,8 +1596,8 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint( attributes.multicastLocatorList = m_att.defaultMulticastLocatorList; attributes.external_unicast_locators = m_att.default_external_unicast_locators; } - createReceiverResources(attributes.unicastLocatorList, false, true); - createReceiverResources(attributes.multicastLocatorList, false, true); + createReceiverResources(attributes.unicastLocatorList, false, true, true); + createReceiverResources(attributes.multicastLocatorList, false, true, true); } fastdds::rtps::ExternalLocatorsProcessor::set_listening_locators(attributes.external_unicast_locators, @@ -1681,7 +1681,8 @@ void RTPSParticipantImpl::setup_external_locators( bool RTPSParticipantImpl::createReceiverResources( LocatorList_t& Locator_list, bool ApplyMutation, - bool RegisterReceiver) + bool RegisterReceiver, + bool log_when_creation_fails) { std::vector> newItemsBuffer; bool ret_val = Locator_list.empty(); @@ -1709,6 +1710,11 @@ bool RTPSParticipantImpl::createReceiverResources( } } + if (!ret && log_when_creation_fails) + { + EPROSIMA_LOG_WARNING(RTPS_PARTICIPANT, "Could not create the specified receiver resource"); + } + ret_val |= !newItemsBuffer.empty(); for (auto it_buffer = newItemsBuffer.begin(); it_buffer != newItemsBuffer.end(); ++it_buffer) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index 03b68851747..47e9d20fd2c 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -981,11 +981,13 @@ class RTPSParticipantImpl * @param Locator_list - Locator list to be used to create the ReceiverResources * @param ApplyMutation - True if we want to create a Resource with a "similar" locator if the one we provide is unavailable * @param RegisterReceiver - True if we want the receiver to be registered. Useful for receivers created after participant is enabled. + * @param log_when_creation_fails - True if a log warning shall be issued for each locator when a receiver resource cannot be created. */ bool createReceiverResources( LocatorList_t& Locator_list, bool ApplyMutation, - bool RegisterReceiver); + bool RegisterReceiver, + bool log_when_creation_fails); void createSenderResources( const LocatorList_t& locator_list);