astitcher commented on code in PR #370:
URL: https://github.com/apache/qpid-proton/pull/370#discussion_r877038436
##########
cpp/src/contexts.hpp:
##########
@@ -100,6 +100,7 @@ class connection_context : public context {
std::unique_ptr<reconnect_context> reconnect_context_;
listener_context* listener_context_;
work_queue work_queue_;
+ std::string c_url_;
Review Comment:
I suggest to call this connected_url_, or active_url_, or current_url_
##########
cpp/src/connection.cpp:
##########
@@ -93,6 +93,12 @@ session_range connection::sessions() const {
return
session_range(session_iterator(make_wrapper(pn_session_head(pn_object(), 0))));
}
+std::string connection::url() const {
+ connection_context& cc = connection_context::get(pn_object());
+ if(!active()) throw proton::error("No active connection");
Review Comment:
I think this is an open question - what to do when the connection is not
active: Could throw an exception as this code does, or somehow return nullptr
maybe but then would need to change the return type and returning an pointer
isn't a good idea overall. Or maybe return an option, but we don't do this
anywhere else/
The issue here is whether it will be a bad user experience to receive an
exception in the non active case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]