From 8e296230775deade9c63f48e61a1ccc9c7e3f4da Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 16 Feb 2014 19:48:27 +0100 Subject: [Qt] show number of in/out connections in debug console --- src/qt/clientmodel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index f273b9ea4..cb832fdd4 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 -- cgit v1.2.3