Skip to content

Commit c230154

Browse files
Check if SHM transport is disabled in LARGE_DATA modes (#5355) (#5376)
* Refs #21959: Check for SHM_DISABLE in large_data setup modes Signed-off-by: Mario-DL <[email protected]> * Refs #21959: Apply Miguels rev Signed-off-by: Mario Dominguez <[email protected]> * Refs #21959: Apply suggestion Signed-off-by: Mario Dominguez <[email protected]> --------- Signed-off-by: Mario-DL <[email protected]> Signed-off-by: Mario Dominguez <[email protected]> (cherry picked from commit a7dfdf5) Co-authored-by: Mario Domínguez López <[email protected]>
1 parent f3a38df commit c230154

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp

+20-10
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,32 @@ static void setup_transports_udpv6(
217217
att.userTransports.push_back(descriptor);
218218
}
219219

220+
static void setup_large_data_shm_transport(
221+
RTPSParticipantAttributes& att,
222+
const fastdds::rtps::BuiltinTransportsOptions& options)
223+
{
224+
#ifdef FASTDDS_SHM_TRANSPORT_DISABLED
225+
static_cast<void>(att);
226+
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Trying to configure Large Data transport, " <<
227+
"but Fast DDS was built without SHM transport support. Will use " <<
228+
"TCP for communications on the same host.");
229+
#else
230+
auto descriptor = create_shm_transport(att, options);
231+
att.userTransports.push_back(descriptor);
232+
233+
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
234+
att.defaultUnicastLocatorList.push_back(shm_loc);
235+
#endif // FASTDDS_SHM_TRANSPORT_DISABLED
236+
}
237+
220238
static void setup_transports_large_data(
221239
RTPSParticipantAttributes& att,
222240
bool intraprocess_only,
223241
const fastdds::rtps::BuiltinTransportsOptions& options)
224242
{
225243
if (!intraprocess_only)
226244
{
227-
auto shm_transport = create_shm_transport(att, options);
228-
att.userTransports.push_back(shm_transport);
229-
230-
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
231-
att.defaultUnicastLocatorList.push_back(shm_loc);
245+
setup_large_data_shm_transport(att, options);
232246

233247
auto tcp_transport = create_tcpv4_transport(att, options);
234248
att.userTransports.push_back(tcp_transport);
@@ -261,11 +275,7 @@ static void setup_transports_large_datav6(
261275
{
262276
if (!intraprocess_only)
263277
{
264-
auto shm_transport = create_shm_transport(att, options);
265-
att.userTransports.push_back(shm_transport);
266-
267-
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
268-
att.defaultUnicastLocatorList.push_back(shm_loc);
278+
setup_large_data_shm_transport(att, options);
269279

270280
auto tcp_transport = create_tcpv6_transport(att, options);
271281
att.userTransports.push_back(tcp_transport);

0 commit comments

Comments
 (0)