Skip to content

Commit

Permalink
Create PublisherData within NodeData
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <yadunund@intrinsic.ai>
  • Loading branch information
Yadunund committed Sep 27, 2024
1 parent d19c278 commit 47a876c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_node_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ bool NodeData::create_pub_data(
const rmw_qos_profile_t * qos_profile)
{
std::lock_guard<std::mutex> lock_guard(mutex_);
if (is_shutdown_) {
RMW_ZENOH_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"Unable to create PublisherData as the NodeData has been shutdown.");
return false;
}

if (pubs_.count(publisher) > 0) {
RMW_ZENOH_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/rmw_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ rmw_publisher_event_init(
}

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

Expand Down

0 comments on commit 47a876c

Please sign in to comment.