This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
rmw_connext_shared_cpp/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,23 @@ create_node(
5353 // This String_dup is not matched with a String_free because DDS appears to
5454 // free this automatically.
5555 participant_qos.participant_name .name = DDS::String_dup (name);
56+ // since the participant name is not part of the DDS spec
57+ // the node name is also set in the user_data
58+ DDS_Long name_length = strlen (name);
59+ const char prefix[6 ] = " name=" ;
60+ bool success = participant_qos.user_data .value .length (name_length + sizeof (prefix));
61+ if (!success) {
62+ RMW_SET_ERROR_MSG (" failed to resize participant user_data" );
63+ return NULL ;
64+ }
65+ memcpy (participant_qos.user_data .value .get_contiguous_buffer (), prefix, sizeof (prefix) - 1 );
66+ {
67+ for (DDS_Long i = 0 ; i < name_length; ++i) {
68+ participant_qos.user_data .value [sizeof (prefix) - 1 + i] = name[i];
69+ }
70+ participant_qos.user_data .value [sizeof (prefix) - 1 + name_length] = ' ;' ;
71+ }
72+
5673 // forces local traffic to be sent over loopback,
5774 // even if a more efficient transport (such as shared memory) is installed
5875 // (in which case traffic will be sent over both transports)
You can’t perform that action at this time.
0 commit comments