getpeerinfo
…
[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-
Diapolo commented at 6:53 pm on February 16, 2014: noneI found it usefull to directly see the numbers, no need to go over
-
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.laanwj commented at 12:53 pm on February 18, 2014: memberI agree that this information is useful to have in the debug window.int03h commented at 10:12 pm on February 18, 2014: noneby debug you mean –printtoconsole ? I agree, if thats the case.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?laanwj commented at 7:36 am on February 19, 2014: memberOh 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.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 :).Diapolo commented at 1:29 pm on February 19, 2014: noneUpdated and shortened code a lot.laanwj added this to the milestone 0.10.0 on Feb 28, 2014sipa commented at 12:58 pm on February 28, 2014: memberHaven’t tested, but agree that showing in/out connections is a good fit there.laanwj commented at 1:45 pm on February 28, 2014: memberWorks for me.[Qt] show number of in/out connections in debug console 8e29623077BitcoinPullTester commented at 10:22 pm on March 3, 2014: noneAutomatic 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.laanwj referenced this in commit 218be95903 on Mar 10, 2014laanwj merged this on Mar 10, 2014laanwj closed this on Mar 10, 2014
Diapolo deleted the branch on Mar 10, 2014DrahtBot locked this on Sep 8, 2021
Diapolo laanwj int03h sipa BitcoinPullTesterMilestone
0.10.0
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-12-19 00:12 UTC
More mirrored repositories can be found on mirror.b10c.me