-
Notifications
You must be signed in to change notification settings - Fork 90
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
Ensure compliant subscription API. #214
Conversation
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
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.
LGTM. I just realised that this prioritizes the error code from publishing the ros discovery topic (a side effect) over the error code from actually destroying the subscription (the primary operation) if both error, and that might be somewhat counterintuitive. The same is true for destroying the publisher, it's just that I didn't realise it at that time.
That said, in this case and for Cyclone DDS, actually destroying the subscription/publication only fails when its handle is no longer valid, which requires having explicitly deleted the entity, its parent (the DDS subscriber), its grandparent (the DDS participant), greatgrandparent (DDS domain instance) or great-greatgrandparent (the Cyclone DDS library initialisation through the magic DDS_CYCLONEDDS_HANDLE
). In all but the last of those cases, the return code will be DDS_RETCODE_BAD_PARAMETER
, in the last one, it will be DDS_RETCODE_PRECONDITION_NOT_MET
.
Arguably, that makes the possible error codes from trying to publish the update to the ros discovery topic more interesting. I also don't see any reason to suggest changing this now. But as a rule, propagating errors from the primary operation rather than those from side-effects seems to make the most sense.
Hmm, that's a very good point. And I'm inclined to change it. |
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
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.
LGTM!
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Depends on ros2/rmw#256.