Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle RMW_DEFAULT_DOMAIN_ID. #194

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions rmw_cyclonedds_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,10 @@ rmw_context_impl_t::init(rmw_init_options_t * options)
failed: otherwise there is a race with rmw_destroy_node deleting the last participant
and tearing down the domain for versions of Cyclone that implement the original
version of dds_create_domain that doesn't return a handle. */
this->domain_id = static_cast<dds_domainid_t>(options->domain_id);
this->domain_id = static_cast<dds_domainid_t>(
// No custom handling of RMW_DEFAULT_DOMAIN_ID. Simply use a reasonable domain id.
options->domain_id != RMW_DEFAULT_DOMAIN_ID ? options->domain_id : 0u);

if (!check_create_domain(this->domain_id, options->localhost_only)) {
return RMW_RET_ERROR;
}
Expand Down Expand Up @@ -1114,8 +1117,7 @@ extern "C" rmw_ret_t rmw_init(const rmw_init_options_t * options, rmw_context_t
eclipse_cyclonedds_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

/* domain_id = UINT32_MAX = Cyclone DDS' "default domain id".*/
if (options->domain_id >= UINT32_MAX) {
if (options->domain_id >= UINT32_MAX && options->domain_id != RMW_DEFAULT_DOMAIN_ID) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_cyclonedds_cpp", "rmw_create_node: domain id out of range");
return RMW_RET_INVALID_ARGUMENT;
Expand Down