Fix conversions between rmw_localhost_only_t and bool (#670)
* Check for case RMW_LOCALHOST_ONLY_DISABLED in init_options * Take init value from node context * Convert enum variable to boolean * Remove extra check * Remove not needed reference and dereference * Change rcl_get_localhost_only to match signature * Add parenthesis to make clearer precedence Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
This commit is contained in:
parent
f82eecafdd
commit
acd167e173
2 changed files with 7 additions and 7 deletions
|
@ -41,6 +41,9 @@ rcl_get_localhost_only(rmw_localhost_only_t * localhost_only)
|
||||||
get_env_error_str);
|
get_env_error_str);
|
||||||
return RCL_RET_ERROR;
|
return RCL_RET_ERROR;
|
||||||
}
|
}
|
||||||
*localhost_only = ros_local_host_env_val != NULL && strcmp(ros_local_host_env_val, "1") == 0;
|
*localhost_only = (ros_local_host_env_val != NULL &&
|
||||||
|
strcmp(
|
||||||
|
ros_local_host_env_val,
|
||||||
|
"1") == 0) ? RMW_LOCALHOST_ONLY_ENABLED : RMW_LOCALHOST_ONLY_DISABLED;
|
||||||
return RCL_RET_OK;
|
return RCL_RET_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,15 +263,12 @@ rcl_node_init(
|
||||||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Using domain ID of '%zu'", domain_id);
|
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Using domain ID of '%zu'", domain_id);
|
||||||
node->impl->actual_domain_id = domain_id;
|
node->impl->actual_domain_id = domain_id;
|
||||||
|
|
||||||
if (RMW_LOCALHOST_ONLY_DEFAULT == localhost_only) {
|
localhost_only = context->impl->init_options.impl->rmw_init_options.localhost_only;
|
||||||
if (RMW_RET_OK != rcl_get_localhost_only(&localhost_only)) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node->impl->rmw_node_handle = rmw_create_node(
|
node->impl->rmw_node_handle = rmw_create_node(
|
||||||
&(node->context->impl->rmw_context),
|
&(node->context->impl->rmw_context),
|
||||||
name, local_namespace_, domain_id, localhost_only);
|
name, local_namespace_, domain_id,
|
||||||
|
localhost_only == RMW_LOCALHOST_ONLY_ENABLED);
|
||||||
|
|
||||||
RCL_CHECK_FOR_NULL_WITH_MSG(
|
RCL_CHECK_FOR_NULL_WITH_MSG(
|
||||||
node->impl->rmw_node_handle, rmw_get_error_string().str, goto fail);
|
node->impl->rmw_node_handle, rmw_get_error_string().str, goto fail);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue