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

Fix interest initialization #839

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions include/zenoh-pico/session/interest.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ _z_session_interest_rc_t *_z_register_interest(_z_session_t *zn, _z_session_inte
void _z_unregister_interest(_z_session_t *zn, _z_session_interest_rc_t *intr);
#endif // Z_FEATURE_INTEREST == 1

void _z_interest_init(_z_session_t *zn);
void _z_flush_interest(_z_session_t *zn);
z_result_t _z_interest_process_declares(_z_session_t *zn, const _z_declaration_t *decl);
z_result_t _z_interest_process_undeclares(_z_session_t *zn, const _z_declaration_t *decl);
Expand Down
9 changes: 9 additions & 0 deletions src/session/interest.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ void _z_unregister_interest(_z_session_t *zn, _z_session_interest_rc_t *intr) {
_z_session_mutex_unlock(zn);
}

void _z_interest_init(_z_session_t *zn) {
_z_session_mutex_lock(zn);
zn->_local_interests = NULL;
zn->_remote_declares = NULL;
_z_session_mutex_unlock(zn);
}

void _z_flush_interest(_z_session_t *zn) {
_z_session_mutex_lock(zn);
_z_session_interest_rc_list_free(&zn->_local_interests);
Expand Down Expand Up @@ -457,6 +464,8 @@ z_result_t _z_interest_process_interest(_z_session_t *zn, _z_keyexpr_t key, uint
}

#else
void _z_interest_init(_z_session_t *zn) { _ZP_UNUSED(zn); }

void _z_flush_interest(_z_session_t *zn) { _ZP_UNUSED(zn); }

z_result_t _z_interest_process_declares(_z_session_t *zn, const _z_declaration_t *decl) {
Expand Down
2 changes: 2 additions & 0 deletions src/session/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ z_result_t _z_session_init(_z_session_rc_t *zsrc, _z_id_t *zid) {
_z_liveliness_init(zn);
#endif

_z_interest_init(zn);

zn->_local_zid = *zid;
// Note session in transport
switch (zn->_tp._type) {
Expand Down
Loading