You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Stephen Tyree (JIRA)" <ji...@apache.org> on 2011/03/15 15:41:29 UTC

[jira] Created: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Implement function in C client to determine which host you're currently connected to.
-------------------------------------------------------------------------------------

                 Key: ZOOKEEPER-1020
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
             Project: ZooKeeper
          Issue Type: New Feature
          Components: c client
            Reporter: Stephen Tyree
            Priority: Minor


On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:

const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);

Clients could use it like below:

  char buffer[33];
  unsigned short port = 0;
  if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
    return EXIT_FAILURE;

  printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007558#comment-13007558 ] 

Benjamin Reed commented on ZOOKEEPER-1020:
------------------------------------------

hadoopqa is right. we need a test. you could add a test to TestClient.cc or even just modify testAuth in that code to call zookeeper_get_connected_host before and after the stopServer calls to check both the connected and disconnected case.


> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment: ZOOKEEPER-1020.patch

Patch to add functionality.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment: ZOOKEEPER-1020.patch

This time with proper spacing.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt reassigned ZOOKEEPER-1020:
---------------------------------------

    Assignee: Stephen Tyree

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Assignee: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment: ZOOKEEPER-1020.patch

This time with a unit test.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007662#comment-13007662 ] 

Hadoop QA commented on ZOOKEEPER-1020:
--------------------------------------

+1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12473832/ZOOKEEPER-1020.patch
  against trunk revision 1082260.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/193//testReport/
Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/193//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/193//console

This message is automatically generated.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment: ZOOKEEPER-1020.patch

This time the diff is from the root directory of trunk.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch, ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-1020:
------------------------------------

    Fix Version/s: 3.4.0

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Assignee: Stephen Tyree
>            Priority: Minor
>             Fix For: 3.4.0
>
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment:     (was: ZOOKEEPER-1020.patch)

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment:     (was: ZOOKEEPER-1020.patch)

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007271#comment-13007271 ] 

Hadoop QA commented on ZOOKEEPER-1020:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12473721/ZOOKEEPER-1020.patch
  against trunk revision 1081936.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no new tests are needed for this patch.
                        Also please list what manual steps were performed to verify this patch.

    -1 patch.  The patch command could not apply the patch.

Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/189//console

This message is automatically generated.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007886#comment-13007886 ] 

Hudson commented on ZOOKEEPER-1020:
-----------------------------------

Integrated in ZooKeeper-trunk #1124 (See [https://hudson.apache.org/hudson/job/ZooKeeper-trunk/1124/])
    ZOOKEEPER-1020. Implement function in C client to determine which host you're currently connected to.


> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007507#comment-13007507 ] 

Hadoop QA commented on ZOOKEEPER-1020:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12473800/ZOOKEEPER-1020.patch
  against trunk revision 1081936.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no new tests are needed for this patch.
                        Also please list what manual steps were performed to verify this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/191//testReport/
Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/191//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/191//console

This message is automatically generated.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment:     (was: ZOOKEEPER-1020.patch)

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment: ZOOKEEPER-1020.patch

Updated the patch based on Benjamin Reed's comments.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Tyree updated ZOOKEEPER-1020:
-------------------------------------

    Attachment:     (was: ZOOKEEPER-1020.patch)

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1020) Implement function in C client to determine which host you're currently connected to.

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007045#comment-13007045 ] 

Stephen Tyree commented on ZOOKEEPER-1020:
------------------------------------------

Posting discussion with Benjamin Reed while on the IRC channel:

13:19 < breed_zk>  it looks good, but i think it might be better to use sockaddr instead of converting to a string. we should return a null if we aren't connected. your
                  patch really tells the host that you should be connected to rather than which one you are connected to. maybe use getpeername
13:21 < styree> Ok, so the function would return the sockaddr of the connection, letting the client do any conversion they want to?
13:21 < styree> And calling getpeername on the fd used to talk to Zookeeper
13:24 < styree> Using the sockaddr would remove the need to seperate the function into getting the host and the port, but how do we feel about the function name?
13:31 < breed_zk> yes
13:32 < breed_zk> one sec
13:32 < styree> k
13:35 < breed_zk> there is this, perhaps silly, distinction we make with the naming in C. zoo_ is for standard zookeeper calls, where zookeeper_ is for the management
                  API, so by that logic i think it should be called zookeeper_get_connected_host.

So I'm going to rename the function zookeeper_get_connected_host and have it return the underlying sockaddr for the connection based on getpeername.

> Implement function in C client to determine which host you're currently connected to.
> -------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1020
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1020
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: c client
>            Reporter: Stephen Tyree
>            Priority: Minor
>         Attachments: ZOOKEEPER-1020.patch
>
>
> On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:
> const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);
> Clients could use it like below:
>   char buffer[33];
>   unsigned short port = 0;
>   if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
>     return EXIT_FAILURE;
>   printf("The connected host is: %s:%d\n", buffer, port);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira