-
Notifications
You must be signed in to change notification settings - Fork 162
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
Fix conversions between rmw_localhost_only_t and bool #670
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
364b772
Check for case RMW_LOCALHOST_ONLY_DISABLED in init_options
Blast545 3093642
Take init value from node context
Blast545 442615d
Convert enum variable to boolean
Blast545 ffae768
Remove extra check
Blast545 c992146
Remove not needed reference and dereference
Blast545 d45ff22
Change rcl_get_localhost_only to match signature
Blast545 04dfa57
Add parenthesis to make clearer precedence
Blast545 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
context->impl->init_options.impl->rmw_init_options.localhost_only
is of typermw_localhost_only_t
what needs to be fixed is
rcl_get_localhost_only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rcl_get_localhost_only
is not called if a user setslocalhost_only=RMW_LOCALHOST_ONLY_DISABLED
in thermw_init_options_t
struct. That's the case being covered by this portion of code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in that case
rcl_get_localhost_only
is not being called, and there's no need to modifylocalhost_only
value either (i.e. whencontext->impl->init_options.impl->rmw_init_options.localhost_only == RMW_LOCALHOST_ONLY_DISABLED
things are working well).They are not working well when
context->impl->init_options.impl->rmw_init_options.localhost_only == RMW_LOCALHOST_ONLY_DEFAULT
because of this line. That needs to be corrected.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That line is returning 1 or 0 properly (although its signature is misleading and has to be changed, left an issue opened for that).
But I do think it's not OK that all the functions receiving that enum have to make the boolean comparison against
RMW_LOCALHOST_ONLY_DISABLED
before using the value and IMO this should be addressed in this function where the context is initialized.I'll remove this because the check you suggested me for
node.c
solves the case I was addressing but it would be great to come back at this at some point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's returning
1
or0
and setting that to armw_localhost_only_t
which doesn't expect1/0
, so that line is wrong. It should be:The signature is ok and shouldn't be changed. The idea is that in the future we will have the following functions:
There would be equivalents in
rclcpp/rclpy
for those.If the default constructed
init_options
isn't modified with those functions, localhost only will be set according to the environment variable (as by default it's value is RMW_LOCALHOST_ONLY_DEFAULT).If the user explicitly enabled/disabled it, the environment variable won't be checked.
As a consequence, at
rcl
level the variable can bedefault/enable/disable
, and atrmw
implementation level can be onlyenable/disable
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll open a PR for that in the
rcl_get_localhost_only
function. This PR is about passing the context setting to the node, mind giving your thoughts on it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why opening another PR, as I think this change is incorrect and the only problem is in
rcl_get_localhost_only
.Can you explain what this extra
else/if
does?Can you explain what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO there are two problems:
The one fixed in this PR,
localhost_only
being loaded from environment variable innode.c
although this variable was already loaded in init.crcl_get_localhost_only returning boolean instead of rmw_localhost_only_t.
This PR fixes problem 1.
Based on my conversation with you, that else/if was removed, please check the latest commit of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not returning a boolean, it's returning
rmw_localhost_only_t
and doing the conversion incorrectly.IMO, we should fix the logic in this same PR as today is the deadline for merging things before Foxy release (anyways we can backport the fix in a patch release, so it's not a big deal).
I didn't see the commit that removed that 😂.