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

[19773] Rework log upon receiver resource creation failure (backport #3954) #3957

Closed
wants to merge 1 commit into from
Closed
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
28 changes: 23 additions & 5 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,11 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint(
}

// Try creating receiver resources
<<<<<<< HEAD
if (createReceiverResources(pend->getAttributes().unicastLocatorList, false, true))
=======
if (createReceiverResources(attributes.unicastLocatorList, false, true, false))
>>>>>>> 63c415072 (Rework log upon receiver resource creation failure (#3954))
{
break;
}
Expand Down Expand Up @@ -1544,8 +1548,13 @@ bool RTPSParticipantImpl::createAndAssociateReceiverswithEndpoint(
pend->getAttributes().unicastLocatorList = m_att.defaultUnicastLocatorList;
pend->getAttributes().multicastLocatorList = m_att.defaultMulticastLocatorList;
}
<<<<<<< HEAD
createReceiverResources(pend->getAttributes().unicastLocatorList, false, true);
createReceiverResources(pend->getAttributes().multicastLocatorList, false, true);
=======
createReceiverResources(attributes.unicastLocatorList, false, true, true);
createReceiverResources(attributes.multicastLocatorList, false, true, true);
>>>>>>> 63c415072 (Rework log upon receiver resource creation failure (#3954))
}

// Associate the Endpoint with ReceiverControlBlock
Expand Down Expand Up @@ -1615,7 +1624,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 +1653,14 @@ bool RTPSParticipantImpl::createReceiverResources(
}
}

<<<<<<< HEAD
=======
if (!ret && log_when_creation_fails)
{
EPROSIMA_LOG_WARNING(RTPS_PARTICIPANT, "Could not create the specified receiver resource");
}

>>>>>>> 63c415072 (Rework log upon receiver resource creation failure (#3954))
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