Skip to content

Commit

Permalink
Check if SHM transport is disabled in LARGE_DATA modes (#5355) (#…
Browse files Browse the repository at this point in the history
…5377)

* Refs #21959: Check for SHM_DISABLE in large_data setup modes

Signed-off-by: Mario-DL <mariodominguez@eprosima.com>

* Refs #21959: Apply Miguels rev

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21959: Apply suggestion

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario-DL <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit a7dfdf5)

Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Mario-DL authored Nov 15, 2024
1 parent 66ec998 commit f743ee1
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,32 @@ static void setup_transports_udpv6(
att.userTransports.push_back(descriptor);
}

static void setup_large_data_shm_transport(
RTPSParticipantAttributes& att,
const fastdds::rtps::BuiltinTransportsOptions& options)
{
#ifdef FASTDDS_SHM_TRANSPORT_DISABLED
static_cast<void>(att);
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Trying to configure Large Data transport, " <<
"but Fast DDS was built without SHM transport support. Will use " <<
"TCP for communications on the same host.");
#else
auto descriptor = create_shm_transport(att, options);
att.userTransports.push_back(descriptor);

auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
att.defaultUnicastLocatorList.push_back(shm_loc);
#endif // FASTDDS_SHM_TRANSPORT_DISABLED
}

static void setup_transports_large_data(
RTPSParticipantAttributes& att,
bool intraprocess_only,
const fastdds::rtps::BuiltinTransportsOptions& options)
{
if (!intraprocess_only)
{
auto shm_transport = create_shm_transport(att, options);
att.userTransports.push_back(shm_transport);

auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
att.defaultUnicastLocatorList.push_back(shm_loc);
setup_large_data_shm_transport(att, options);

auto tcp_transport = create_tcpv4_transport(att, options);
att.userTransports.push_back(tcp_transport);
Expand Down Expand Up @@ -260,11 +274,7 @@ static void setup_transports_large_datav6(
{
if (!intraprocess_only)
{
auto shm_transport = create_shm_transport(att, options);
att.userTransports.push_back(shm_transport);

auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
att.defaultUnicastLocatorList.push_back(shm_loc);
setup_large_data_shm_transport(att, options);

auto tcp_transport = create_tcpv6_transport(att, options);
att.userTransports.push_back(tcp_transport);
Expand Down

0 comments on commit f743ee1

Please sign in to comment.