Skip to content

Commit 6128468

Browse files
committed
Removed shm and small fix
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
1 parent 0814156 commit 6128468

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

rmw_zenoh_cpp/src/detail/rmw_client_data.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void ClientData::add_new_reply(std::unique_ptr<ZenohReply> reply)
236236
"Query queue depth of %ld reached, discarding oldest Query "
237237
"for client for %s",
238238
adapted_qos_profile.depth,
239-
keyexpr_.value().as_string_view());
239+
std::string(keyexpr_.value().as_string_view()).c_str());
240240
reply_queue_.pop_front();
241241
}
242242
reply_queue_.emplace_back(std::move(reply));
@@ -417,7 +417,7 @@ rmw_ret_t ClientData::send_request(
417417
RMW_ZENOH_LOG_ERROR_NAMED(
418418
"rmw_zenoh_cpp",
419419
"Unable to obtain ClientData from data for %s.",
420-
sample.get_keyexpr().as_string_view());
420+
std::string(sample.get_keyexpr().as_string_view()).c_str());
421421
return;
422422
}
423423

rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp

+2-33
Original file line numberDiff line numberDiff line change
@@ -209,47 +209,16 @@ rmw_ret_t PublisherData::publish(
209209

210210
// To store serialized message byte array.
211211
char * msg_bytes = nullptr;
212-
std::optional<z_owned_shm_mut_t> shmbuf = std::nullopt;
213-
auto always_free_shmbuf = rcpputils::make_scope_exit(
214-
[&shmbuf]() {
215-
if (shmbuf.has_value()) {
216-
z_drop(z_move(shmbuf.value()));
217-
}
218-
});
219212

220213
rcutils_allocator_t * allocator = &rmw_node_->context->options.allocator;
221214

222215
auto always_free_msg_bytes = rcpputils::make_scope_exit(
223-
[&msg_bytes, allocator, &shmbuf]() {
224-
if (msg_bytes && !shmbuf.has_value()) {
216+
[&msg_bytes, allocator]() {
217+
if (msg_bytes) {
225218
allocator->deallocate(msg_bytes, allocator->state);
226219
}
227220
});
228221

229-
// TODO(anyone): Move this zenoh_cpp API
230-
// Get memory from SHM buffer if available.
231-
// if (shm_provider.has_value()) {
232-
// RMW_ZENOH_LOG_DEBUG_NAMED("rmw_zenoh_cpp", "SHM is enabled.");
233-
234-
// auto provider = shm_provider.value()._0;
235-
// z_buf_layout_alloc_result_t alloc;
236-
// // TODO(yuyuan): SHM, configure this
237-
// z_alloc_alignment_t alignment = {5};
238-
// z_shm_provider_alloc_gc_defrag_blocking(
239-
// &alloc,
240-
// z_loan(provider),
241-
// SHM_BUF_OK_SIZE,
242-
// alignment);
243-
244-
// if (alloc.status == ZC_BUF_LAYOUT_ALLOC_STATUS_OK) {
245-
// shmbuf = std::make_optional(alloc.buf);
246-
// msg_bytes = reinterpret_cast<char *>(z_shm_mut_data_mut(z_loan_mut(alloc.buf)));
247-
// } else {
248-
// // TODO(Yadunund): Should we revert to regular allocation and not return an error?
249-
// RMW_SET_ERROR_MSG("Failed to allocate a SHM buffer, even after GCing.");
250-
// return RMW_RET_ERROR;
251-
// }
252-
// } else {
253222
// Get memory from the allocator.
254223
msg_bytes = static_cast<char *>(allocator->allocate(max_data_length, allocator->state));
255224
RMW_CHECK_FOR_NULL_WITH_MSG(

0 commit comments

Comments
 (0)