aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2014-02-16 19:48:27 +0100
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2014-03-03 22:35:02 +0100
commit8e296230775deade9c63f48e61a1ccc9c7e3f4da (patch)
tree854545f3e8777abc8383f0b1a1c6b52a10d62f7e /src/qt/clientmodel.cpp
parentaefbf6e30cadaf77ebee44284c74cc5449dc173f (diff)
[Qt] show number of in/out connections in debug console
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index f273b9ea46..cb832fdd42 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -39,9 +39,18 @@ ClientModel::~ClientModel()
unsubscribeFromCoreSignals();
}
-int ClientModel::getNumConnections() const
+int ClientModel::getNumConnections(unsigned int flags) const
{
- return vNodes.size();
+ LOCK(cs_vNodes);
+ if (flags == CONNECTIONS_ALL) // Shortcut if we want total
+ return vNodes.size();
+
+ int nNum = 0;
+ BOOST_FOREACH(CNode* pnode, vNodes)
+ if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
+ nNum++;
+
+ return nNum;
}
int ClientModel::getNumBlocks() const