#include "addrman.h"
#include "hash.h"
+#include "random.h"
+#include "streams.h"
using namespace std;
{
// use a tried node
double fChanceFactor = 1.0;
- while(1)
+ for ( ; ; )
{
int nKBucket = GetRandInt(vvTried.size());
std::vector<int> &vTried = vvTried[nKBucket];
} else {
// use a new node
double fChanceFactor = 1.0;
- while(1)
+ for ( ; ; )
{
int nUBucket = GetRandInt(vvNew.size());
std::set<int> &vNew = vvNew[nUBucket];
if (nTime - info.nTime > nUpdateInterval)
info.nTime = nTime;
}
+
+CAddrMan::CAddrMan() : vRandom(0), vvTried(ADDRMAN_TRIED_BUCKET_COUNT, std::vector<int>(0)), vvNew(ADDRMAN_NEW_BUCKET_COUNT, std::set<int>())
+{
+ nKey.resize(32);
+ GetRandBytes(&nKey[0], 32);
+
+ nIdCount = 0;
+ nTried = 0;
+ nNew = 0;
+}