Skip to content

Commit

Permalink
WIN32 Seed Cleanup: Move nLastPerfmon behind win32 ifdef.
Browse files Browse the repository at this point in the history
Code to avoid calling Perfmon too often is only needed when perfmon is actually going to get called.
This is not intended to make any functional difference in the addition of entropy to the random pool.
  • Loading branch information
21E14 authored and Warrows committed Oct 28, 2018
1 parent 8b79a39 commit 3f8c6b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/random.cpp
Expand Up @@ -47,15 +47,16 @@ void RandAddSeedPerfmon()
{
RandAddSeed();

#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data

// This can take up to 2 seconds, so only do it every 10 minutes
static int64_t nLastPerfmon;
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();

#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data
std::vector<unsigned char> vData(250000, 0);
long ret = 0;
unsigned long nSize = 0;
Expand Down

0 comments on commit 3f8c6b7

Please sign in to comment.