Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rcl_get_localhost_only function not returning a rmw_localhost_only_t value #669

Closed
Blast545 opened this issue Jun 2, 2020 · 2 comments
Closed
Assignees

Comments

@Blast545
Copy link
Contributor

Blast545 commented Jun 2, 2020

While adding tests for the rcl package I realized the localhost.c function rcl_get_localhost_only uses this logic to return the possible value of the localhost_only variable:

*localhost_only = ros_local_host_env_val != NULL && strcmp(ros_local_host_env_val, "1") == 0;

Which only returns 0 or 1, but the current possible values for this variable are 0-1-2, as implemented in rmw/localhost.h:

typedef enum RMW_PUBLIC_TYPE rmw_localhost_only_t
{
  /// Uses ROS_LOCALHOST_ONLY environment variable.
  RMW_LOCALHOST_ONLY_DEFAULT = 0,
  /// Forces using only localhost.
  RMW_LOCALHOST_ONLY_ENABLED = 1,
  /// Forces disabling localhost only.
  RMW_LOCALHOST_ONLY_DISABLED = 2,
} rmw_localhost_only_t;
@Blast545 Blast545 self-assigned this Jun 2, 2020
@Blast545 Blast545 changed the title localhost.c function not returning all possible values rcl_get_localhost_only function not returning all possible values Jun 2, 2020
@Blast545
Copy link
Contributor Author

Blast545 commented Jun 2, 2020

After checking the expected usage of this function, it is expected that the result of this function to be a boolean value because the result coming from this is then fed to rmw_create_node() that takes localhost_only value as a boolean.

I think the solution to this would be changing the rcl_get_localhost_only signature to return boolean instead.

@Blast545 Blast545 changed the title rcl_get_localhost_only function not returning all possible values rcl_get_localhost_only function not returning a rmw_localhost_only_t value Jun 2, 2020
@Blast545
Copy link
Contributor Author

Blast545 commented Jun 8, 2020

Closed with #670

@Blast545 Blast545 closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant