diff options
| author | Philip Kaufmann <[email protected]> | 2014-02-16 19:48:27 +0100 |
|---|---|---|
| committer | Philip Kaufmann <[email protected]> | 2014-03-03 22:35:02 +0100 |
| commit | 8e296230775deade9c63f48e61a1ccc9c7e3f4da (patch) | |
| tree | 854545f3e8777abc8383f0b1a1c6b52a10d62f7e /src/qt/clientmodel.cpp | |
| parent | doc: Empty release notes for next release (diff) | |
| download | discoin-8e296230775deade9c63f48e61a1ccc9c7e3f4da.tar.xz discoin-8e296230775deade9c63f48e61a1ccc9c7e3f4da.zip | |
[Qt] show number of in/out connections in debug console
Diffstat (limited to 'src/qt/clientmodel.cpp')
| -rw-r--r-- | src/qt/clientmodel.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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 |