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

Implement liveliness support #632

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sashacmc
Copy link
Member

@sashacmc sashacmc commented Sep 6, 2024

Implement liveliness support, can be enabled/disabled by means of Z_FEATURE_LIVELINESS

  • Token:

    • z_liveliness_declare_token
    • z_liveliness_undeclare_token
  • Subscriber: (require Z_FEATURE_SUBSCRIPTION enabled)

    • z_liveliness_declare_subscriber
  • Query: (require Z_FEATURE_QUERY enabled)

    • z_liveliness_get
  • Token interest query processing

Examples:

  • z_sub_liveliness
  • z_get_liveliness
  • z_liveliness

Additionally:

  • Implemented iterator for _z_int_void_map
  • Cleaned up (reused) stuff from pull subscribers ( _remote_subscriptions)

Closes: #621

Copy link

github-actions bot commented Sep 6, 2024

PR missing one of the required labels: {'bug', 'dependencies', 'new feature', 'internal', 'documentation', 'enhancement', 'breaking-change'}

@sashacmc sashacmc added the new feature Something new is needed label Sep 6, 2024
@sashacmc sashacmc force-pushed the liveliness branch 4 times, most recently from 2398a24 to 86d3455 Compare November 7, 2024 10:22
@sashacmc sashacmc changed the title Implement liveliness token support Implement liveliness support Nov 7, 2024
@sashacmc sashacmc force-pushed the liveliness branch 2 times, most recently from ed89516 to aff1ff4 Compare November 7, 2024 16:23
@sashacmc sashacmc marked this pull request as ready for review November 7, 2024 17:16

static volatile int keepRunning = 1;

void intHandler(int dummy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need that ?
I'm not sure to see the added value.
(We don't have this in rust example)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, neither session closing nor token undeclaration is called at all, the example with zenoh-pico is simply interrupted. Yes, after the session loss timeout, the router will report the loss of the token, but for example in multicast peer-to-peer this will not happen.

include/zenoh-pico/api/liveliness.h Outdated Show resolved Hide resolved
src/api/liveliness.c Show resolved Hide resolved
src/api/liveliness.c Outdated Show resolved Hide resolved
src/session/liveliness.c Outdated Show resolved Hide resolved
@OlivierHecart
Copy link
Contributor

Another general comment:
As far as I understood, disconnection is not really managed yet run pico. But theoretically (and in Rust) when connectivity is lost, all remote tokens should be undeclared: an active liveliness subscriber should receive DEL messages for all alive remote tokens, and a liveliness get performed after the disconnection should get no replies.
Not sure if we want to handle that in this PR or another one.

@sashacmc
Copy link
Member Author

Another general comment: As far as I understood, disconnection is not really managed yet run pico. But theoretically (and in Rust) when connectivity is lost, all remote tokens should be undeclared: an active liveliness subscriber should receive DEL messages for all alive remote tokens, and a liveliness get performed after the disconnection should get no replies. Not sure if we want to handle that in this PR or another one.

Yes, make sense, I created an issue to don't forget do it after I rework disconnection handling in #767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Something new is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement liveliness token support
3 participants