Skip to content

Commit 7c345cf

Browse files
Fix: node namespace name (#148) (#149)
* Fix: node namespace name * Fix * Update * Uncrstify (cherry picked from commit 1ec1489) Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
1 parent 7b7cbe6 commit 7c345cf

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

rmw_microxrcedds_c/src/rmw_node.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,20 @@ rmw_node_t * create_node(
9191
(uint16_t)domain_id,
9292
rmw_uxrce_entity_naming_buffer, UXR_REPLACE | UXR_REUSE);
9393
#else
94+
static char xrce_node_name[RMW_UXRCE_NODE_NAME_MAX_LENGTH];
95+
96+
if (strcmp(namespace_, "/") == 0) {
97+
snprintf(xrce_node_name, RMW_UXRCE_NODE_NAME_MAX_LENGTH, "%s", name);
98+
} else {
99+
snprintf(xrce_node_name, RMW_UXRCE_NODE_NAME_MAX_LENGTH, "%s/%s", namespace_, name);
100+
}
101+
94102
participant_req = uxr_buffer_create_participant_bin(
95103
&node_info->context->session,
96104
*node_info->context->creation_destroy_stream,
97105
node_info->participant_id,
98106
domain_id,
99-
name,
107+
xrce_node_name,
100108
UXR_REPLACE | UXR_REUSE);
101109
#endif /* ifdef RMW_UXRCE_USE_REFS */
102110

@@ -129,7 +137,7 @@ rmw_create_node(
129137
if (!name || strlen(name) == 0) {
130138
RMW_SET_ERROR_MSG("name is null");
131139
} else if (!namespace_ || strlen(namespace_) == 0) {
132-
RMW_SET_ERROR_MSG("node handle not from this implementation");
140+
RMW_SET_ERROR_MSG("namespace is null");
133141
} else {
134142
rmw_node = create_node(name, namespace_, domain_id, context);
135143
}

0 commit comments

Comments
 (0)