Skip to content

Commit 67ce284

Browse files
mergify[bot]Mario-DLMiguelCompany
authored
Check if SHM transport is disabled in LARGE_DATA modes (#5355) (#5378)
* Check if `SHM` transport is disabled in `LARGE_DATA` modes (#5355) * 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) # Conflicts: # src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp * Fix conflicts Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Mario Domínguez López <[email protected]> Co-authored-by: Miguel Company <[email protected]>
1 parent d1b63eb commit 67ce284

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp

+19-10
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,30 @@ static void setup_transports_udpv6(
186186
att.userTransports.push_back(descriptor);
187187
}
188188

189+
static void setup_large_data_shm_transport(
190+
RTPSParticipantAttributes& att)
191+
{
192+
#ifdef FASTDDS_SHM_TRANSPORT_DISABLED
193+
static_cast<void>(att);
194+
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Trying to configure Large Data transport, " <<
195+
"but Fast DDS was built without SHM transport support. Will use " <<
196+
"TCP for communications on the same host.");
197+
#else
198+
auto descriptor = create_shm_transport(att);
199+
att.userTransports.push_back(descriptor);
200+
201+
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
202+
att.defaultUnicastLocatorList.push_back(shm_loc);
203+
#endif // FASTDDS_SHM_TRANSPORT_DISABLED
204+
}
205+
189206
static void setup_transports_large_data(
190207
RTPSParticipantAttributes& att,
191208
bool intraprocess_only)
192209
{
193210
if (!intraprocess_only)
194211
{
195-
auto shm_transport = create_shm_transport(att);
196-
att.userTransports.push_back(shm_transport);
197-
198-
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
199-
att.defaultUnicastLocatorList.push_back(shm_loc);
212+
setup_large_data_shm_transport(att);
200213

201214
auto tcp_transport = create_tcpv4_transport(att);
202215
att.userTransports.push_back(tcp_transport);
@@ -229,11 +242,7 @@ static void setup_transports_large_datav6(
229242
{
230243
if (!intraprocess_only)
231244
{
232-
auto shm_transport = create_shm_transport(att);
233-
att.userTransports.push_back(shm_transport);
234-
235-
auto shm_loc = fastdds::rtps::SHMLocator::create_locator(0, fastdds::rtps::SHMLocator::Type::UNICAST);
236-
att.defaultUnicastLocatorList.push_back(shm_loc);
245+
setup_large_data_shm_transport(att);
237246

238247
auto tcp_transport = create_tcpv6_transport(att);
239248
att.userTransports.push_back(tcp_transport);

0 commit comments

Comments
 (0)