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

z_session_drop should call z_close #689

Open
milyin opened this issue Sep 14, 2024 · 0 comments
Open

z_session_drop should call z_close #689

milyin opened this issue Sep 14, 2024 · 0 comments
Labels
internal Changes not included in the changelog

Comments

@milyin
Copy link
Contributor

milyin commented Sep 14, 2024

Currenly z_session_drop simply drops rust's Session object and z_close explicitly calls Session::close().

This difference is not really significant: there is no clone operation for Session object in zenoh-c, so dropping last session instance is the same as explicit close.

But this difference makes code unclear for ones who want to understand difference between z_close and z_session_drop by reading sources. Is it a bug that z_session_drop doesn't close session explicitly? Is the behavior of z_close and z_session_drop different and how?

The fact that z_close accepts z_close_options_t parameter makes things even more complicated.

The proposal for right now is to explicitly call z_close from z_session_drop with NULL options parameter. I.e. it will be obvious, that z_session_drop and z_close are equal except this options parameter.

In the future if we decide to restore clone operation for the session this behavior could be changed

@milyin milyin added the internal Changes not included in the changelog label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
Status: No status
Development

No branches or pull requests

1 participant