Skip to content
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

Wrap zenoh session with a shared pointer #332

Closed
wants to merge 149 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
e2fabb6
Update style.yaml
Mallets Jul 23, 2024
6cd6dbe
Update check_logging.yaml
Mallets Jul 23, 2024
dcefb68
Update build.yaml
Mallets Jul 23, 2024
14fe58c
chore: configure the compiliation
YuanYuYuan Jun 20, 2024
301a8ce
chore: complete the 1st version
YuanYuYuan Jun 25, 2024
8ef92b5
fix: memory leak
YuanYuYuan Jul 18, 2024
06b6fa4
wip
YuanYuYuan Jul 25, 2024
71e7c5b
fix: z_error_t -> z_result_t
YuanYuYuan Jul 26, 2024
a717270
Fix `scouting/*/autoconnect/*` per eclipse-zenoh/zenoh@b31a410 (#3)
fuzzypixelz Jul 24, 2024
cfa63d9
chore: checkout the local zenoh-c
YuanYuYuan Jul 30, 2024
12dc820
chore: polish z_open
YuanYuYuan Jul 31, 2024
d331b74
fix: segfault
YuanYuYuan Jul 31, 2024
1db4bef
feat: `z_bytes_serialize_from_slice` without copy
YuanYuYuan Jul 31, 2024
d12f189
chore: switch back to https://github.com/eclipse-zenoh/zenoh-c
YuanYuYuan Jul 31, 2024
909329b
Initialize `query_` member of `ZenohQuery`
fuzzypixelz Jul 26, 2024
511c6f6
refactor: use `z_owned_slice_t` instead
YuanYuYuan Jul 31, 2024
044d25b
chore: adapt the latest change of zenoh-c dev/1.0.0
YuanYuYuan Aug 2, 2024
d79cf5e
chore: use `strncmp` to avoid copying
YuanYuYuan Aug 7, 2024
6637400
refactor: use `z_view_keyexpr_t` to avoid copying
YuanYuYuan Aug 8, 2024
83334c8
feat: implment the SHM feature
YuanYuYuan Aug 8, 2024
bf0da8a
chore: adpat the new changes from zenoh-c and fix the bug in liveliness
YuanYuYuan Aug 13, 2024
dfc95ad
fix: segmentation fault due to the unallocated query memory
YuanYuYuan Aug 18, 2024
cd071e5
fix: workaround the ZID parsing issue
YuanYuYuan Aug 26, 2024
4f842fd
fix Zenoh Config read\check
yellowhatter Aug 22, 2024
af2e344
adopt to recent zenoh-c API changes
yellowhatter Aug 23, 2024
0225a59
chore: sync up with the rolling branch
YuanYuYuan Aug 27, 2024
36140fd
chore: update to self-hosted runners
imstevenpmwork Aug 27, 2024
080eb15
fix: adapt the latest change of batching config
YuanYuYuan Aug 29, 2024
f60c2a2
Merge remote-tracking branch 'origin/rolling' into dev/1.0.0
YuanYuYuan Aug 29, 2024
83a26f2
build: deprecate the zenohc_debug and incldue the zenohc dependency i…
YuanYuYuan Aug 29, 2024
31a76fd
Use main branch for upgrading to Zenoh 1.0
evshary Sep 2, 2024
7dba674
Merge pull request #14 from ZettaScaleLabs/update_branch
evshary Sep 2, 2024
b5cdd73
Increase the delay in scouting (#16)
evshary Sep 4, 2024
191181a
Merge remote-tracking branch 'origin/rolling' into dev/1.0.0
YuanYuYuan Sep 5, 2024
aed64e8
fixup! Merge remote-tracking branch 'origin/rolling' into dev/1.0.0
YuanYuYuan Sep 5, 2024
dd0e541
chore: ament_uncrustify and ament_cpplint
YuanYuYuan Sep 5, 2024
7dcc7d6
ci: fix the argument order in the style CI
YuanYuYuan Sep 5, 2024
7bbfdf5
chore: remove .clang_format
YuanYuYuan Sep 5, 2024
ed51a81
chore: clean up
YuanYuYuan Sep 5, 2024
975ea82
refactor: use `z_id_to_string`
YuanYuYuan Sep 5, 2024
17adcfa
chore: tidy up
YuanYuYuan Sep 5, 2024
e62c9bd
build: use the latest zenoh-c commit
YuanYuYuan Sep 5, 2024
458414d
build: enable the unstable feature flag
YuanYuYuan Sep 5, 2024
bf49775
chore: make iron ament_uncrustify happy
YuanYuYuan Sep 5, 2024
1630e11
test: check uncrustify version
YuanYuYuan Sep 5, 2024
c0a7533
fixup! test: check uncrustify version
YuanYuYuan Sep 5, 2024
798b006
chore: make iron ament_uncrustify happy
YuanYuYuan Sep 5, 2024
7d7a296
test
YuanYuYuan Sep 5, 2024
30aae80
Revert "test"
YuanYuYuan Sep 5, 2024
4f369c5
build: bump up the zenoh-c commit
YuanYuYuan Sep 9, 2024
39f10d5
chore(style): align rmw_zenoh.cpp
YuanYuYuan Sep 10, 2024
c7c17a6
chore(styel): align detail/rmw_data_types.cpp
YuanYuYuan Sep 10, 2024
1eef11d
chore(style): align rmw_init.cpp
YuanYuYuan Sep 10, 2024
e57ce89
chore(style): align detail/attachment_helpers.cpp
YuanYuYuan Sep 10, 2024
86940a8
build: update zenoh-c version
YuanYuYuan Sep 10, 2024
3aba418
chore(style): align the remaining files
YuanYuYuan Sep 10, 2024
05ff443
chore(style): consistently use `Z_OK` in the if condition
YuanYuYuan Sep 10, 2024
dd1e691
chore(style): ament_uncrustify
YuanYuYuan Sep 10, 2024
5bf7cc0
chore(style): ament_cpplint
YuanYuYuan Sep 10, 2024
206e34e
fix: set the max size of initial query queue to `SIZE_MAX - 1`
YuanYuYuan Sep 11, 2024
e9d0513
fix: iterator memory leak
YuanYuYuan Sep 16, 2024
520a3a2
feat: update to zenoh-c 1.0.0.8 changes
imstevenpmwork Sep 13, 2024
fce8a62
chore(style): address `ament_cpplint` and `ament_uncrustiy`
YuanYuYuan Sep 16, 2024
09c5cbc
fix: initiate zenoh logger
YuanYuYuan Sep 17, 2024
54dd96a
chore: apply the suggestions
YuanYuYuan Sep 19, 2024
becea93
chore: add the comments for the zenoh logger
YuanYuYuan Sep 19, 2024
9df5b82
Merge branch 'rolling' into dev/1.0.0
YuanYuYuan Sep 20, 2024
1f135c2
fix: store and destroy the subscriber properly
YuanYuYuan Sep 20, 2024
5177594
chore: improve the null pointer check: NULL => nullptr
YuanYuYuan Sep 20, 2024
6a48919
Change liveliness tokens logs from warn to debug level (#22)
JEnoch Sep 23, 2024
6fd7e1c
fix: properly clone the pointer of query and reply to resolve the seg…
YuanYuYuan Sep 27, 2024
8d3fce9
chore: update to zenoh-c 1.0.0.9 (#23)
imstevenpmwork Sep 27, 2024
73d68af
Sleep for 100ms between router checks (#284)
Yadunund Sep 25, 2024
16916cb
Fix how total_count and total_count_change are calculated for matched…
Yadunund Sep 27, 2024
f089982
Thread-safe access to graph cache (#258)
Yadunund Sep 27, 2024
63530b7
fix: adapt the latest changes in rolling
YuanYuYuan Sep 30, 2024
afd7f63
Merge remote-tracking branch 'origin/rolling' into dev/1.0.0
YuanYuYuan Sep 30, 2024
a67b194
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Oct 1, 2024
c8724d2
fix: addres the conflict
YuanYuYuan Oct 2, 2024
979896a
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Oct 2, 2024
d022967
chore: adapt the latest change
YuanYuYuan Oct 2, 2024
1cfc9f6
refactor(api): align with latest serialization changes
YuanYuYuan Oct 2, 2024
bb64fde
chore(deps): bump up zenoh-c to 1.0.0.10
YuanYuYuan Oct 2, 2024
4aef9e7
chore(api): align with latest serialization changes
imstevenpmwork Oct 2, 2024
c386a3d
fix: correct the sub_ke and selector_ke in the querying_subscriber
YuanYuYuan Oct 3, 2024
37134bb
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Oct 7, 2024
93e733f
fix: thread-safe publisher
YuanYuYuan Oct 7, 2024
eeb9985
Enable history option for liveliness subscriber. (#27)
evshary Oct 8, 2024
bec4a52
refactor!: adopt the TLS config renaming
YuanYuYuan Oct 8, 2024
f32daa9
refactor: allow Zenoh session to close without dropping
YuanYuYuan Oct 8, 2024
14d17b0
fix: address the failure in rclcpp/test_wait_for_message of delcaring…
YuanYuYuan Oct 8, 2024
60a2e8d
Merge branch 'wip/merge-rolling' into dev/1.0.0
YuanYuYuan Oct 8, 2024
589971e
test: close but not drop the session
YuanYuYuan Oct 8, 2024
9b65df5
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Oct 9, 2024
c7d3a5b
fix: correct the merge
YuanYuYuan Oct 9, 2024
6ba342b
chore: Explicit false in adminspace config
imstevenpmwork Oct 9, 2024
143fa88
fix: enable admin space in rmw router and ros nodes
gabrik Oct 10, 2024
52070b2
Merge pull request #29 from ZettaScaleLabs/fix/enable-admin-space
imstevenpmwork Oct 10, 2024
5ae0e3a
Bump zenoh-c version. (#30)
evshary Oct 11, 2024
257de16
Use the latest zenoh-c which fix some nav2 issues. (#31)
evshary Oct 14, 2024
736c34e
Update config files according to Zenoh 1.0.0 DEFAULT_CONFIG.json5 (#33)
JEnoch Oct 15, 2024
030959f
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Oct 24, 2024
ec8aa99
chore(zenoh_c_vendor): bumb up zenoh-c version
YuanYuYuan Oct 24, 2024
ab5e0be
fix: adjust the merge
YuanYuYuan Oct 24, 2024
24f479b
refactor: remove the free_attachment
YuanYuYuan Oct 24, 2024
e6b7ecb
Fix unset request header writer GUID (#36)
fuzzypixelz Oct 24, 2024
bc6f6d6
Merge branch 'dev/1.0.0' into wip/merge-rolling
YuanYuYuan Oct 24, 2024
8024b7a
fix: keyexpr is missing in the service
YuanYuYuan Oct 24, 2024
3a5cc80
style: ament_uncrustify
YuanYuYuan Oct 24, 2024
5c3d385
style: apply iron ament_uncrustify
YuanYuYuan Oct 24, 2024
bb8e0ec
Avoid touching Zenoh Session while exiting. (#37)
evshary Oct 31, 2024
787376c
chore(deps): bump up zenoh-c to 1.0.1
YuanYuYuan Nov 4, 2024
ec7776e
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Nov 7, 2024
2cfa97c
fix: adjust the merge
YuanYuYuan Nov 7, 2024
28d917e
style: ament_cpplint
YuanYuYuan Nov 7, 2024
f400ab5
SHM support (#39)
yellowhatter Nov 13, 2024
14683cd
fix: use TRUE value to configure the feature flag
YuanYuYuan Nov 14, 2024
d44002e
fix: fix the SHM enabled check
YuanYuYuan Nov 14, 2024
8557523
fix: inlcude shm_context.cpp in the build
YuanYuYuan Nov 14, 2024
cb87b1e
revert: SHM support
YuanYuYuan Nov 15, 2024
46ec449
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Nov 15, 2024
2743344
fix: adapt the merge and bump up zenoh-c version
YuanYuYuan Nov 18, 2024
09798c3
chore: remove .gitignore
YuanYuYuan Nov 19, 2024
b6df66c
fix: correct typo `attachement` to `attachment`
YuanYuYuan Nov 19, 2024
59203df
Merge branch 'rolling' into wip/merge-rolling
YuanYuYuan Nov 19, 2024
9f78ca4
style: ament_cpplint and ament_uncrustify
YuanYuYuan Nov 19, 2024
7450bb2
refactor: remove the warning of subscriber reliability QoS
YuanYuYuan Nov 20, 2024
5ade015
fix: add back atexit handler
YuanYuYuan Nov 20, 2024
1e705c1
merge: integrate rolling into dev/1.0.0
YuanYuYuan Nov 21, 2024
2e3ad43
Revert "Don't shutdown contained entities. (#313)"
YuanYuYuan Nov 21, 2024
c41ee5a
Reapply "Don't shutdown contained entities. (#313)"
YuanYuYuan Nov 22, 2024
aa19545
chore: include the string_array.h
YuanYuYuan Nov 22, 2024
b485a93
fix: include "rcutils/types/string_array.h"
YuanYuYuan Nov 22, 2024
0dffa49
Fix `z_view_string_t` to `std::string` conversion (#45)
fuzzypixelz Nov 27, 2024
91df63c
fix: address the comments
YuanYuYuan Nov 28, 2024
70990e7
style: ament_cpplint
YuanYuYuan Nov 28, 2024
33f0bec
refactor: remove the workaround for the atexit shutdown
YuanYuYuan Nov 28, 2024
b8ce65c
fix: correct the call by ref
YuanYuYuan Nov 28, 2024
435186a
refactor: revert the header clean
YuanYuYuan Nov 28, 2024
93afc16
refactor: zc_liveliness_* -> z_liveliness_* and bump up zenoh-c version
YuanYuYuan Nov 29, 2024
17865d2
refactor: reorder the cancel functions
YuanYuYuan Nov 29, 2024
0255c37
chore: reorder some lines of code
YuanYuYuan Dec 4, 2024
09b45c3
refactor: add `session_is_valid` check
YuanYuYuan Dec 4, 2024
0e1cca1
fixup! refactor: reorder the cancel functions
YuanYuYuan Dec 4, 2024
09ecde7
fixup! refactor: zc_liveliness_* -> z_liveliness_* and bump up zenoh-…
YuanYuYuan Dec 5, 2024
8f4949c
fixup! fix: address the comments
YuanYuYuan Dec 5, 2024
84d1267
chore: address the comment
YuanYuYuan Dec 5, 2024
afd1a1e
refactor: wrap the zenoh session with a shared pointer
YuanYuYuan Nov 29, 2024
1ecdd5c
refactor!: unify the `initialized_` flag
YuanYuYuan Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: uncrustify
run: /ros_entrypoint.sh ament_uncrustify --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp rmw_zenoh_cpp/
run: /ros_entrypoint.sh ament_uncrustify rmw_zenoh_cpp/ --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp
- name: cpplint
run: /ros_entrypoint.sh ament_cpplint --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp rmw_zenoh_cpp/
run: /ros_entrypoint.sh ament_cpplint rmw_zenoh_cpp/ --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp
4 changes: 0 additions & 4 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ find_package(rosidl_typesupport_fastrtps_c REQUIRED)
find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
find_package(rmw REQUIRED)
find_package(zenoh_c_vendor REQUIRED)
find_package(zenohc_debug QUIET)
if(NOT zenohc_debug_FOUND)
find_package(zenohc REQUIRED)
endif()

add_library(rmw_zenoh_cpp SHARED
src/detail/attachment_helpers.cpp
Expand Down
325 changes: 278 additions & 47 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5

Large diffs are not rendered by default.

338 changes: 286 additions & 52 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5

Large diffs are not rendered by default.

125 changes: 67 additions & 58 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,83 +16,92 @@

#include <cstdlib>
#include <cstring>
#include <string>
#include <stdexcept>
#include <string_view>
#include <utility>

#include "rmw/types.h"

#include "attachment_helpers.hpp"

namespace rmw_zenoh_cpp
{
//==============================================================================
bool get_gid_from_attachment(
const z_attachment_t * const attachment, uint8_t gid[RMW_GID_STORAGE_SIZE])
{
if (!z_check(*attachment)) {
return false;
}

z_bytes_t index = z_attachment_get(*attachment, z_bytes_new("source_gid"));
if (!z_check(index)) {
return false;
}

if (index.len != RMW_GID_STORAGE_SIZE) {
return false;
}
attachment_data_t::attachment_data_t(
const int64_t _sequence_number,
const int64_t _source_timestamp,
const uint8_t _source_gid[RMW_GID_STORAGE_SIZE])
{
sequence_number = _sequence_number;
source_timestamp = _source_timestamp;
memcpy(source_gid, _source_gid, RMW_GID_STORAGE_SIZE);
}

memcpy(gid, index.start, index.len);
attachment_data_t::attachment_data_t(attachment_data_t && data)
{
sequence_number = std::move(data.sequence_number);
source_timestamp = std::move(data.source_timestamp);
memcpy(source_gid, data.source_gid, RMW_GID_STORAGE_SIZE);
}

return true;
void attachment_data_t::serialize_to_zbytes(z_owned_bytes_t * attachment)
{
ze_owned_serializer_t serializer;
ze_serializer_empty(&serializer);
ze_serializer_serialize_str(z_loan_mut(serializer), "sequence_number");
ze_serializer_serialize_int64(z_loan_mut(serializer), this->sequence_number);
ze_serializer_serialize_str(z_loan_mut(serializer), "source_timestamp");
ze_serializer_serialize_int64(z_loan_mut(serializer), this->source_timestamp);
ze_serializer_serialize_str(z_loan_mut(serializer), "source_gid");
ze_serializer_serialize_buf(z_loan_mut(serializer), this->source_gid, RMW_GID_STORAGE_SIZE);
ze_serializer_finish(z_move(serializer), attachment);
}

//==============================================================================
int64_t get_int64_from_attachment(
const z_attachment_t * const attachment, const std::string & name)
attachment_data_t::attachment_data_t(const z_loaned_bytes_t * attachment)
{
if (!z_check(*attachment)) {
// A valid request must have had an attachment
return -1;
ze_deserializer_t deserializer = ze_deserializer_from_bytes(attachment);
z_owned_string_t key;

// Deserialize the sequence_number
ze_deserializer_deserialize_string(&deserializer, &key);
if (std::string_view(
z_string_data(z_loan(key)),
z_string_len(z_loan(key))) != "sequence_number")
{
throw std::runtime_error("sequence_number is not found in the attachment.");
}

z_bytes_t index = z_attachment_get(*attachment, z_bytes_new(name.c_str()));
if (!z_check(index)) {
return -1;
z_drop(z_move(key));
if (ze_deserializer_deserialize_int64(&deserializer, &this->sequence_number)) {
throw std::runtime_error("Failed to deserialize the sequence_number.");
}

if (index.len < 1) {
return -1;
// Deserialize the source_timestamp
ze_deserializer_deserialize_string(&deserializer, &key);
if (std::string_view(
z_string_data(z_loan(key)),
z_string_len(z_loan(key))) != "source_timestamp")
{
throw std::runtime_error("source_timestamp is not found in the attachment");
}

if (index.len > 19) {
// The number was larger than we expected
return -1;
z_drop(z_move(key));
if (ze_deserializer_deserialize_int64(&deserializer, &this->source_timestamp)) {
throw std::runtime_error("Failed to deserialize the source_timestamp.");
}

// The largest possible int64_t number is INT64_MAX, i.e. 9223372036854775807.
// That is 19 characters long, plus one for the trailing \0, means we need 20 bytes.
char int64_str[20];

memcpy(int64_str, index.start, index.len);
int64_str[index.len] = '\0';

errno = 0;
char * endptr;
int64_t num = strtol(int64_str, &endptr, 10);
if (num == 0) {
// This is an error regardless; the client should never send this
return -1;
} else if (endptr == int64_str) {
// No values were converted, this is an error
return -1;
} else if (*endptr != '\0') {
// There was junk after the number
return -1;
} else if (errno != 0) {
// Some other error occurred, which may include overflow or underflow
return -1;
// Deserialize the source_gid
ze_deserializer_deserialize_string(&deserializer, &key);
if (std::string_view(z_string_data(z_loan(key)), z_string_len(z_loan(key))) != "source_gid") {
throw std::runtime_error("Invalid attachment: the key source_gid is not found");
}

return num;
z_drop(z_move(key));
z_owned_slice_t slice;
if (ze_deserializer_deserialize_slice(&deserializer, &slice)) {
throw std::runtime_error("Failed to deserialize the source_gid.");
}
if (z_slice_len(z_loan(slice)) != RMW_GID_STORAGE_SIZE) {
throw std::runtime_error("The length of source_gid mismatched.");
}
memcpy(this->source_gid, z_slice_data(z_loan(slice)), z_slice_len(z_loan(slice)));
z_drop(z_move(slice));
}
} // namespace rmw_zenoh_cpp
24 changes: 16 additions & 8 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@

#include <zenoh.h>

#include <string>

#include "rmw/types.h"

namespace rmw_zenoh_cpp
{
//==============================================================================
bool get_gid_from_attachment(
const z_attachment_t * const attachment, uint8_t gid[RMW_GID_STORAGE_SIZE]);

//==============================================================================
int64_t get_int64_from_attachment(
const z_attachment_t * const attachment, const std::string & name);
class attachment_data_t final
{
public:
explicit attachment_data_t(
const int64_t _sequence_number,
const int64_t _source_timestamp,
const uint8_t _source_gid[RMW_GID_STORAGE_SIZE]);
explicit attachment_data_t(const z_loaned_bytes_t *);
explicit attachment_data_t(attachment_data_t && data);

int64_t sequence_number;
int64_t source_timestamp;
uint8_t source_gid[RMW_GID_STORAGE_SIZE];

void serialize_to_zbytes(z_owned_bytes_t *);
};
} // namespace rmw_zenoh_cpp

#endif // DETAIL__ATTACHMENT_HELPERS_HPP_
7 changes: 4 additions & 3 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,10 @@ void GraphCache::parse_del(

if (entity->type() == EntityType::Node) {
// Node
// The liveliness tokens to remove pub/subs should be received before the one to remove a node
// given the reliability QoS for liveliness subs. However, if we find any pubs/subs present in
// the node below, we should update the count in graph_topics_.
// When destroying a node, Zenoh does not guarantee that liveliness tokens to remove pub/subs
// arrive before the one to remove the node from the graph despite un-registering those entities
// earlier. In such scenarios, if we find any pub/subs present in the node, we reduce their
// counts in graph_topics_.
const GraphNodePtr graph_node = node_it->second;
if (!graph_node->pubs_.empty() ||
!graph_node->subs_.empty() ||
Expand Down
13 changes: 5 additions & 8 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,11 @@ std::optional<rmw_qos_profile_t> keyexpr_to_qos(const std::string & keyexpr)
///=============================================================================
std::string zid_to_str(const z_id_t & id)
{
std::stringstream ss;
ss << std::hex;
for (std::size_t i = 0; i < sizeof(id.id); i++) {
// By Zenoh convention a z_id_t is a little endian u128.
const std::size_t le_idx = sizeof(id.id) - 1 - i;
ss << static_cast<int>(id.id[le_idx]);
}
return ss.str();
z_owned_string_t z_str;
z_id_to_string(&id, &z_str);
std::string str(z_string_data(z_loan(z_str)), z_string_len(z_loan(z_str)));
z_drop(z_move(z_str));
return str;
}

///=============================================================================
Expand Down
Loading