mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix the race condition bug Jed reported. A time jump on startup could cause
an apparently overly-long (or even negative) ledger interval. The fix is to start up time synch earlier and to tolerate slight negative ledger intervals.
This commit is contained in:
@@ -38,7 +38,7 @@ DatabaseCon::~DatabaseCon()
|
||||
Application::Application() :
|
||||
mUNL(mIOService),
|
||||
mNetOps(mIOService, &mMasterLedger), mTempNodeCache(16384, 90), mHashedObjectStore(16384, 300),
|
||||
mSNTPClient(mIOService), mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL),
|
||||
mSNTPClient(mAuxService), mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL),
|
||||
mHashNodeDB(NULL), mNetNodeDB(NULL),
|
||||
mConnectionPool(mIOService), mPeerDoor(NULL), mRPCDoor(NULL)
|
||||
{
|
||||
@@ -51,6 +51,7 @@ extern int RpcDBCount, TxnDBCount, LedgerDBCount, WalletDBCount, HashNodeDBCount
|
||||
|
||||
void Application::stop()
|
||||
{
|
||||
mAuxService.stop();
|
||||
mIOService.stop();
|
||||
mHashedObjectStore.bulkWrite();
|
||||
mValidations.flush();
|
||||
@@ -69,6 +70,11 @@ void Application::run()
|
||||
if (!theConfig.DEBUG_LOGFILE.empty())
|
||||
Log::setLogFile(theConfig.DEBUG_LOGFILE);
|
||||
|
||||
mSNTPClient.init(theConfig.SNTP_SERVERS);
|
||||
|
||||
boost::thread auxThread(boost::bind(&boost::asio::io_service::run, &mAuxService));
|
||||
auxThread.detach();
|
||||
|
||||
//
|
||||
// Construct databases.
|
||||
//
|
||||
@@ -91,6 +97,7 @@ void Application::run()
|
||||
//
|
||||
getUNL().nodeBootstrap();
|
||||
|
||||
|
||||
//
|
||||
// Allow peer connections.
|
||||
//
|
||||
@@ -147,7 +154,6 @@ void Application::run()
|
||||
mNetOps.setLastCloseNetTime(secondLedger->getCloseTimeNC());
|
||||
}
|
||||
|
||||
mSNTPClient.init(theConfig.SNTP_SERVERS);
|
||||
|
||||
mNetOps.setStateTimer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user