Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Set context actual domain id #443

Merged
merged 3 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions rmw_connext_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
return RMW_RET_INVALID_ARGUMENT;
}

const rmw_context_t zero_context = rmw_get_zero_initialized_context();
assert(0 == std::memcmp(context, &zero_context, sizeof(rmw_context_t)));
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved
auto restore_context = rcpputils::make_scope_exit(
[context, &zero_context]() {*context = zero_context;});
[context]() {*context = rmw_get_zero_initialized_context();});

context->instance_id = options->instance_id;
context->implementation_identifier = rti_connext_identifier;
// No custom handling of RMW_DEFAULT_DOMAIN_ID. Simply use a reasonable domain id.
context->actual_domain_id =
RMW_DEFAULT_DOMAIN_ID != options->domain_id ? options->domain_id : 0u;
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved

context->impl = new (std::nothrow) rmw_context_impl_t();
if (nullptr == context->impl) {
Expand Down
5 changes: 1 addition & 4 deletions rmw_connext_shared_cpp/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,9 @@ create_node(
}
}

// No custom handling of RMW_DEFAULT_DOMAIN_ID. Simply use a reasonable domain id.
{
size_t domain_id = context->options.domain_id;
participant = dpf_->create_participant(
static_cast<DDS::DomainId_t>(
domain_id != RMW_DEFAULT_DOMAIN_ID ? domain_id : 0u),
static_cast<DDS::DomainId_t>(context->actual_domain_id),
participant_qos,
NULL,
DDS::STATUS_MASK_NONE);
Expand Down