Skip to content

Commit

Permalink
Refs #19036: SharedMemTransport::is_locator_reachable discards non-sh…
Browse files Browse the repository at this point in the history
…m non-local ports, and shm local ports that cannot open to write

Signed-off-by: eduponz <[email protected]>
  • Loading branch information
EduPonz committed Jul 30, 2024
1 parent efe02ca commit b4833f6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,24 @@ bool SharedMemTransport::is_locator_allowed(
bool SharedMemTransport::is_locator_reachable(
const Locator_t& locator)
{
return SHMLocator::is_shm_and_from_this_host(locator);
bool is_reachable = SHMLocator::is_shm_and_from_this_host(locator);

if (is_reachable)
{
try
{
is_reachable = (nullptr != find_port(locator.port));
}
catch (const std::exception& e)
{
EPROSIMA_LOG_INFO(RTPS_MSG_OUT,
"Local SHM locator '" << locator <<
"' is not reachable; discarding. Reason: " << e.what());
is_reachable = false;
}
}

return is_reachable;
}

LocatorList SharedMemTransport::NormalizeLocator(
Expand Down

0 comments on commit b4833f6

Please sign in to comment.