Skip to content

Commit 0aa2e12

Browse files
authored
Add alternative domain API configuration (#186)
* Add selection of domain_id * Get domain id from init options
1 parent bfb641c commit 0aa2e12

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

rmw_microxrcedds_c/src/rmw_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ rmw_init(
163163
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
164164
context->instance_id = options->instance_id;
165165
context->implementation_identifier = eprosima_microxrcedds_identifier;
166+
context->options.domain_id = options->domain_id;
166167

167168
rmw_uxrce_init_session_memory(&session_memory, custom_sessions, RMW_UXRCE_MAX_SESSIONS);
168169
rmw_uxrce_init_static_input_buffer_memory(

rmw_microxrcedds_c/src/rmw_node.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ rmw_create_node(
134134
size_t domain_id,
135135
bool localhost_only)
136136
{
137-
(void)context;
138137
(void)localhost_only;
139138
rmw_node_t * rmw_node = NULL;
140139
if (!name || strlen(name) == 0) {
141140
RMW_SET_ERROR_MSG("name is null");
142141
} else if (!namespace_ || strlen(namespace_) == 0) {
143142
RMW_SET_ERROR_MSG("namespace is null");
144143
} else {
144+
if (domain_id == 0 && context->options.domain_id != 0) {
145+
domain_id = context->options.domain_id;
146+
}
145147
rmw_node = create_node(name, namespace_, domain_id, context);
146148
}
147149
return rmw_node;

0 commit comments

Comments
 (0)