[Qt] show number of in/out connections in GUI debug console #3685

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:rpc_in_out changing 3 files +28 −4
  1. Diapolo commented at 6:53 pm on February 16, 2014: none
    I found it usefull to directly see the numbers, no need to go over getpeerinfo
  2. in src/qt/clientmodel.cpp: in 330aeb4ef4 outdated
    43@@ -44,6 +44,28 @@ int ClientModel::getNumConnections() const
    44     return vNodes.size();
    45 }
    46 
    47+int ClientModel::getNumConnectionsIn() const
    


    laanwj commented at 8:13 am on February 17, 2014:
    I’d suggest getNumConnections(bool includeInbound=true, bool includeOutbound=true) (edit) Or alternatively define some w/ enumeration bitfield IN OUT INOUT.
  3. laanwj commented at 12:53 pm on February 18, 2014: member
    I agree that this information is useful to have in the debug window.
  4. int03h commented at 10:12 pm on February 18, 2014: none
    by debug you mean –printtoconsole ? I agree, if thats the case.
  5. Diapolo commented at 6:47 am on February 19, 2014: none
    @int03h Sorry no, this is for the GUI debug console.
  6. Diapolo commented at 7:25 am on February 19, 2014: none

    @laanwj How can I handle connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));, when `setNumConnections()``no takes 2 ints (in and out)? I don’t want to rewrite or add net (core) code for this.

    Perhaps just take numConnectionsChanged() as a trigger to query in/out?

  7. laanwj commented at 7:36 am on February 19, 2014: member
    Oh crap the setNumConnections comes from core core? Of course. Ok, in that case, let’s just keep it like this. Please ignore my suggestions except for the int ClientModel::getNumConnections(bitfield enum) one. Would be nice to have one function to get number of connections, not a bunch.
  8. Diapolo commented at 8:16 am on February 19, 2014: none
    @laanwj Can you take another look please.
  9. in src/qt/clientmodel.cpp: in 1b67e8f9f9 outdated
    51+        return getNumConnectionsOut();
    52+
    53+    return 0;
    54+}
    55+
    56+int ClientModel::getNumConnectionsIn() const
    


    laanwj commented at 8:27 am on February 19, 2014:

    This can be shortened a lot. Remove these explicit functions and roll them into getNumConnections. All the cases can be implemented like this this:

    0LOCK(cs_vNodes);
    1if(flags == CONNECTIONS_ALL) // Shortcut if we want total
    2    return vNodes.size();
    3int nNum = 0;
    4BOOST_FOREACH(CNode* pnode, vNodes)
    5if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
    6    nNum++;
    7return mNum;
    

    Then the flags values should be:

    0enum NumConnections {
    1    CONNECTIONS_NONE = 0,
    2    CONNECTIONS_OUT  = (1U << 0),
    3    CONNECTIONS_IN = (1U << 1),
    4    CONNECTIONS_ALL  = CONNECTIONS_OUT | CONNECTIONS_IN,
    5};
    

    Diapolo commented at 1:29 pm on February 19, 2014:
    Thanks for that lesson :).
  10. Diapolo commented at 1:29 pm on February 19, 2014: none
    Updated and shortened code a lot.
  11. laanwj added this to the milestone 0.10.0 on Feb 28, 2014
  12. sipa commented at 12:58 pm on February 28, 2014: member
    Haven’t tested, but agree that showing in/out connections is a good fit there.
  13. laanwj commented at 1:45 pm on February 28, 2014: member
    Works for me.
  14. [Qt] show number of in/out connections in debug console 8e29623077
  15. BitcoinPullTester commented at 10:22 pm on March 3, 2014: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/8e296230775deade9c63f48e61a1ccc9c7e3f4da for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  16. laanwj referenced this in commit 218be95903 on Mar 10, 2014
  17. laanwj merged this on Mar 10, 2014
  18. laanwj closed this on Mar 10, 2014

  19. Diapolo deleted the branch on Mar 10, 2014
  20. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-05 04:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me