устранил предупреждения компилятора
[novacoin.git] / src / qt / clientmodel.cpp
index c100188..ec66cc3 100644 (file)
@@ -14,7 +14,7 @@
 extern double GetPoSKernelPS();
 extern double GetDifficulty(const CBlockIndex* blockindex);
 
-static const int64 nClientStartupTime = GetTime();
+static const int64_t nClientStartupTime = GetTime();
 
 ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
     QObject(parent), optionsModel(optionsModel),
@@ -48,9 +48,18 @@ double ClientModel::getDifficulty(bool fProofofStake)
        return GetDifficulty(GetLastBlockIndex(pindexBest,false));
 }
 
-int ClientModel::getNumConnections() const
+int ClientModel::getNumConnections(uint8_t flags) const
 {
-    return vNodes.size();
+    LOCK(cs_vNodes);
+    if (flags == CONNECTIONS_ALL) // Shortcut if we want total
+        return (int)(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