Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log warning message upon receiver resource creation failure (backport #3924, backport #3954) #3938

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,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);

// Check metatraffic multicast port
if (0 < m_att.builtin.metatrafficMulticastLocatorList.size() &&
Expand Down Expand Up @@ -1516,7 +1516,7 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint(
}

// Try creating receiver resources
if (createReceiverResources(pend->getAttributes().unicastLocatorList, false, true))
if (createReceiverResources(pend->getAttributes().unicastLocatorList, false, true, false))
{
break;
}
Expand Down Expand Up @@ -1544,8 +1544,8 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint(
pend->getAttributes().unicastLocatorList = m_att.defaultUnicastLocatorList;
pend->getAttributes().multicastLocatorList = m_att.defaultMulticastLocatorList;
}
createReceiverResources(pend->getAttributes().unicastLocatorList, false, true);
createReceiverResources(pend->getAttributes().multicastLocatorList, false, true);
createReceiverResources(pend->getAttributes().unicastLocatorList, false, true, true);
createReceiverResources(pend->getAttributes().multicastLocatorList, false, true, true);
}

// Associate the Endpoint with ReceiverControlBlock
Expand Down Expand Up @@ -1615,7 +1615,8 @@ bool RTPSParticipantImpl::createSendResources(
bool RTPSParticipantImpl::createReceiverResources(
LocatorList_t& Locator_list,
bool ApplyMutation,
bool RegisterReceiver)
bool RegisterReceiver,
bool log_when_creation_fails)
{
std::vector<std::shared_ptr<ReceiverResource>> newItemsBuffer;
bool ret_val = Locator_list.empty();
Expand Down Expand Up @@ -1643,6 +1644,11 @@ bool RTPSParticipantImpl::createReceiverResources(
}
}

if (!ret && log_when_creation_fails)
{
logWarning(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)
Expand Down
4 changes: 3 additions & 1 deletion src/cpp/rtps/participant/RTPSParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,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);
Expand Down