Skip to content

Commit 47a876c

Browse files
committed
Create PublisherData within NodeData
Signed-off-by: Yadunund <[email protected]>
1 parent d19c278 commit 47a876c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

rmw_zenoh_cpp/src/detail/rmw_node_data.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ bool NodeData::create_pub_data(
127127
const rmw_qos_profile_t * qos_profile)
128128
{
129129
std::lock_guard<std::mutex> lock_guard(mutex_);
130+
if (is_shutdown_) {
131+
RMW_ZENOH_LOG_ERROR_NAMED(
132+
"rmw_zenoh_cpp",
133+
"Unable to create PublisherData as the NodeData has been shutdown.");
134+
return false;
135+
}
136+
130137
if (pubs_.count(publisher) > 0) {
131138
RMW_ZENOH_LOG_ERROR_NAMED(
132139
"rmw_zenoh_cpp",

rmw_zenoh_cpp/src/rmw_event.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ rmw_publisher_event_init(
6363
}
6464

6565
rmw_event->implementation_identifier = publisher->implementation_identifier;
66-
// TODO(Yadunund): This is still subject to race conditions. Should we
67-
// set data to context_impl which is assumed to outlast all entities?
66+
// TODO(Yadunund): This assumes that publishers outlive their events
67+
// which is the behavior in rcl/rclcpp.
6868
rmw_event->data = pub_data->events_mgr().get();
6969
rmw_event->event_type = event_type;
7070

0 commit comments

Comments
 (0)