diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-04-16 18:30:03 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2016-09-08 12:12:58 -0400 |
commit | c0569c7fa1e25599b3f1d6a16b15ec23052021da (patch) | |
tree | 608dc14407c8f28de2d6480910a13883dc47cefe /src/qt/clientmodel.cpp | |
parent | 8ae2dac1c65349e4620422a43b7fa9d49af52c11 (diff) |
net: Add most functions needed for vNodes to CConnman
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r-- | src/qt/clientmodel.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 14661b857a..f72bbfe6bb 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -50,16 +50,18 @@ ClientModel::~ClientModel() int ClientModel::getNumConnections(unsigned int flags) const { - LOCK(cs_vNodes); - if (flags == CONNECTIONS_ALL) // Shortcut if we want total - return vNodes.size(); - - int nNum = 0; - BOOST_FOREACH(const CNode* pnode, vNodes) - if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) - nNum++; - - return nNum; + CConnman::NumConnections connections = CConnman::CONNECTIONS_NONE; + + if(flags == CONNECTIONS_IN) + connections = CConnman::CONNECTIONS_IN; + else if (flags == CONNECTIONS_OUT) + connections = CConnman::CONNECTIONS_OUT; + else if (flags == CONNECTIONS_ALL) + connections = CConnman::CONNECTIONS_ALL; + + if(g_connman) + return g_connman->GetNodeCount(connections); + return 0; } int ClientModel::getNumBlocks() const |