mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Improve pool seeding during startup:
* When starting up, we no longer rely just on the standard system RNG to generate entropy: we attempt to squeeze some from the execution state, and to recover any entropy that we had previously stored. * When shutting down, if sufficient entropy has been accumulated attempt to store it for future use.
This commit is contained in:
committed by
Tom Ritchford
parent
382a16ff07
commit
84e618b3f2
@@ -62,6 +62,7 @@
|
||||
#include <ripple/validators/make_Manager.h>
|
||||
#include <ripple/unity/git_id.h>
|
||||
#include <ripple/websocket/MakeServer.h>
|
||||
#include <ripple/crypto/RandomNumbers.h>
|
||||
#include <beast/asio/io_latency_probe.h>
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
||||
@@ -286,6 +287,7 @@ public:
|
||||
std::unique_ptr <Validations> mValidations;
|
||||
std::unique_ptr <LoadManager> m_loadManager;
|
||||
beast::DeadlineTimer m_sweepTimer;
|
||||
beast::DeadlineTimer m_entropyTimer;
|
||||
|
||||
std::unique_ptr <DatabaseCon> mRpcDB;
|
||||
std::unique_ptr <DatabaseCon> mTxnDB;
|
||||
@@ -408,6 +410,8 @@ public:
|
||||
|
||||
, m_sweepTimer (this)
|
||||
|
||||
, m_entropyTimer (this)
|
||||
|
||||
, m_signals(get_io_service(), SIGINT)
|
||||
|
||||
, m_resolver (ResolverAsio::New (get_io_service(), m_logs.journal("Resolver")))
|
||||
@@ -857,6 +861,7 @@ public:
|
||||
m_journal.info << "Application starting. Build is " << gitCommitID();
|
||||
|
||||
m_sweepTimer.setExpiration (10);
|
||||
m_entropyTimer.setRecurringExpiration (300);
|
||||
|
||||
m_io_latency_sampler.start();
|
||||
|
||||
@@ -887,6 +892,8 @@ public:
|
||||
|
||||
m_sweepTimer.cancel ();
|
||||
|
||||
m_entropyTimer.cancel ();
|
||||
|
||||
mValidations->flush ();
|
||||
|
||||
RippleAddress::clearCache ();
|
||||
@@ -952,6 +959,12 @@ public:
|
||||
|
||||
void onDeadlineTimer (beast::DeadlineTimer& timer)
|
||||
{
|
||||
if (timer == m_entropyTimer)
|
||||
{
|
||||
add_entropy (nullptr, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer == m_sweepTimer)
|
||||
{
|
||||
// VFALCO TODO Move all this into doSweep
|
||||
|
||||
Reference in New Issue
Block a user