[ 
https://issues.apache.org/jira/browse/PROTON-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17539545#comment-17539545
 ] 

ASF GitHub Bot commented on PROTON-2540:
----------------------------------------

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.





> [cpp] Provide a way to query proton::connection for the url it was created 
> with
> -------------------------------------------------------------------------------
>
>                 Key: PROTON-2540
>                 URL: https://issues.apache.org/jira/browse/PROTON-2540
>             Project: Qpid Proton
>          Issue Type: New Feature
>          Components: cpp-binding
>            Reporter: Rakhi Kumari
>            Assignee: Rakhi Kumari
>            Priority: Major
>
> Provide a way to connection.url() to identify a connection in a trivial 
> connection handler.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to