-
Notifications
You must be signed in to change notification settings - Fork 33
Ensure compliant matched pub/sub count API. #451
Conversation
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
if (!info) { | ||
RMW_SET_ERROR_MSG("publisher internal data is invalid"); | ||
return RMW_RET_ERROR; | ||
} | ||
if (!info->listener_) { | ||
RMW_SET_ERROR_MSG("publisher internal listener is invalid"); | ||
return RMW_RET_ERROR; | ||
} |
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 are we removing these checks?
(sorry if this is redundant with what we have talked about before)
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.
See ros2/rmw_fastrtps#408 (comment). I can't find the discussion about not duplicating checks across rmw_fastrtps_shared_cpp
and the actual Fast-RTPS based RMW implementation.
But long story short:
- There's no point in checking arguments for nullity twice -- once in
rmw_fastrtps(_dynamic)_cpp
, once inrmw_fastrtps_shared_cpp
. - There's no point in guarding ourselves against those particular UB cases. If an
rmw_fastrtps(_dynamic)_cpp
publisher (or subscription) hasnullptr
internals (or FWIW, any non-valid pointers), then (a) the user is using the structure in an unintended way (and the program is logically incorrect), (b) the implementation is logically incorrect, or (c) memory corruption ensued.
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.
Ah right, thanks for that discussion. Sorry, long day yesterday :).
if (!info) { | ||
RMW_SET_ERROR_MSG("publisher internal data is invalid"); | ||
return RMW_RET_ERROR; | ||
} | ||
if (!info->listener_) { | ||
RMW_SET_ERROR_MSG("publisher internal listener is invalid"); | ||
return RMW_RET_ERROR; | ||
} |
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.
Ah right, thanks for that discussion. Sorry, long day yesterday :).
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Connected to ros2/rmw#262.