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
Currenly
z_session_drop
simply drops rust'sSession
object andz_close
explicitly callsSession::close()
.This difference is not really significant: there is no
clone
operation forSession
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
andz_session_drop
by reading sources. Is it a bug thatz_session_drop
doesn't close session explicitly? Is the behavior ofz_close
andz_session_drop
different and how?The fact that
z_close
acceptsz_close_options_t
parameter makes things even more complicated.The proposal for right now is to explicitly call
z_close
fromz_session_drop
with NULL options parameter. I.e. it will be obvious, thatz_session_drop
andz_close
are equal except thisoptions
parameter.In the future if we decide to restore
clone
operation for the session this behavior could be changed