Skip to content

Commit 32eaf8a

Browse files
author
21E14
committed
WIN32 Seed Cleanup: Move nLastPerfmon behind win32 ifdef.
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.
1 parent 8b298ca commit 32eaf8a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/random.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ void RandAddSeedPerfmon()
4747
{
4848
RandAddSeed();
4949

50+
#ifdef WIN32
51+
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
52+
// Seed with the entire set of perfmon data
53+
5054
// This can take up to 2 seconds, so only do it every 10 minutes
5155
static int64_t nLastPerfmon;
5256
if (GetTime() < nLastPerfmon + 10 * 60)
5357
return;
5458
nLastPerfmon = GetTime();
5559

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

0 commit comments

Comments
 (0)