-
Notifications
You must be signed in to change notification settings - Fork 42
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
refactor: wrap the zenoh session with a shared pointer #333
refactor: wrap the zenoh session with a shared pointer #333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally like the idea here, but I think we need to do some more work particularly in the ClientData
class. I've left a detailed proposal in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are already included in the zenoh_c to zenoh_cpp PR https://github.com/ros2/rmw_zenoh/pull/327/files#diff-124e1086db3e5f3edb76619bd65943a900a963ef671e014c817d3bf27d803908
I do think we should get this one in first, and then go for the switch to zenoh-cpp. That will allow us to concentrate on one thing at a time, and I think this one is largely ready to go (with my one big comment up above still to be addressed). |
Hi @clalancette, I'm trying to understand the underlying issue with the client and the request-in-flight. But I'm wondering why we must clone a session for each request. It seems to me either the callback or the |
Doesn't |
|
No, I don't think we need to handle the reply after the session is closed. In our case, the session being closed is the result of the context being shutdown, and after that point nothing in the higher layers can handle anything new anyway. OK, so in that case, I'm going to withdraw my previous comment about fixing it (though I will open a separate PR doing that for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more change to make, then I think this is good to go.
@@ -406,6 +409,7 @@ rmw_ret_t ClientData::send_request( | |||
if (context_impl == nullptr) { | |||
return RMW_RET_INVALID_ARGUMENT; | |||
} | |||
sess_ = context_impl->session(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this, right? Because we are holding onto the session while this ClientData
is alive, this is an unnecessary additional reference count, and I think it is enough to just keep this in the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's misplaced. Resolved in 416f430
416f430
to
4f34079
Compare
Rebase it against the latest rolling. |
Closes ZettaScaleLabs#44.