Skip to content

Commit

Permalink
Refs #18002. Improve warning message.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Apr 10, 2024
1 parent 25db48b commit 9dc7030
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,21 +1980,29 @@ bool RTPSParticipantImpl::createReceiverResources(

for (auto it_loc = Locator_list.begin(); it_loc != Locator_list.end(); ++it_loc)
{
bool ret = m_network_Factory.BuildReceiverResources(*it_loc, newItemsBuffer, max_receiver_buffer_size);
Locator_t loc = *it_loc;
bool ret = m_network_Factory.BuildReceiverResources(loc, newItemsBuffer, max_receiver_buffer_size);
if (!ret && ApplyMutation)
{
uint32_t tries = 0;
while (!ret && (tries < m_att.builtin.mutation_tries))
{
tries++;
applyLocatorAdaptRule(*it_loc);
ret = m_network_Factory.BuildReceiverResources(*it_loc, newItemsBuffer, max_receiver_buffer_size);
applyLocatorAdaptRule(loc);
ret = m_network_Factory.BuildReceiverResources(loc, newItemsBuffer, max_receiver_buffer_size);
}
}

if (!ret && log_when_creation_fails)
if (ret)
{
EPROSIMA_LOG_WARNING(RTPS_PARTICIPANT, "Could not create the specified receiver resource");
*it_loc = loc;
}
else if (log_when_creation_fails)
{
std::string postfix = ApplyMutation ? ". Applied mutation until: " + IPLocator::to_string(loc) : "";
static_cast<void>(postfix); // Might be unused if log is disabled
EPROSIMA_LOG_WARNING(RTPS_PARTICIPANT,
"Could not create the specified receiver resource for '" << *it_loc << "'" << postfix);
}

ret_val |= !newItemsBuffer.empty();
Expand Down

0 comments on commit 9dc7030

Please sign in to comment.