From 247b55a986125375c8bce149a68c358279832fe2 Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Mon, 22 Jun 2020 12:08:09 -0300 Subject: [PATCH] Handle RMW_DEFAULT_DOMAIN_ID. (#394) Signed-off-by: Michel Hidalgo --- rmw_fastrtps_shared_cpp/src/participant.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/participant.cpp b/rmw_fastrtps_shared_cpp/src/participant.cpp index 5b6ec9d62..78871a26c 100644 --- a/rmw_fastrtps_shared_cpp/src/participant.cpp +++ b/rmw_fastrtps_shared_cpp/src/participant.cpp @@ -164,10 +164,13 @@ rmw_fastrtps_shared_cpp::create_participant( participantAttrs.rtps.builtin.initialPeersList.push_back(local_network_interface_locator); } + // No custom handling of RMW_DEFAULT_DOMAIN_ID. Simply use a reasonable domain id. #if FASTRTPS_VERSION_MAJOR < 2 - participantAttrs.rtps.builtin.domainId = static_cast(domain_id); + participantAttrs.rtps.builtin.domainId = + static_cast(domain_id != RMW_DEFAULT_DOMAIN_ID ? domain_id : 0u); #else - participantAttrs.domainId = static_cast(domain_id); + participantAttrs.domainId = + static_cast(domain_id != RMW_DEFAULT_DOMAIN_ID ? domain_id : 0u); #endif size_t length = snprintf(nullptr, 0, "enclave=%s;", enclave) + 1;