Merge #9408: Allow shutdown during LoadMempool, dump only when necessary

325e400 [Qt] Do proper shutdown (Jonas Schnelli)
9479f8d Allow shutdown during LoadMempool, dump only when necessary (Jonas Schnelli)
This commit is contained in:
Pieter Wuille committed 2017-01-06 09:37:43 -08:00
commit 46b249e578
3 files changed
+7

No files matched your search

+3
View File
@@ -130,6 +130,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
// //
std::atomic<bool> fRequestShutdown(false); std::atomic<bool> fRequestShutdown(false);
std::atomic<bool> fDumpMempoolLater(false);
void StartShutdown() void StartShutdown()
{ {
@@ -211,6 +212,7 @@ void Shutdown()
StopTorControl(); StopTorControl();
UnregisterNodeSignals(GetNodeSignals()); UnregisterNodeSignals(GetNodeSignals());
if (fDumpMempoolLater)
DumpMempool(); DumpMempool();
if (fFeeEstimatesInitialized) if (fFeeEstimatesInitialized)
@@ -669,6 +671,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
} }
} // End scope of CImportingNow } // End scope of CImportingNow
LoadMempool(); LoadMempool();
fDumpMempoolLater = !fRequestShutdown;
} }
/** Sanity checks /** Sanity checks
+2
View File
@@ -444,6 +444,8 @@ void BitcoinApplication::requestShutdown()
delete clientModel; delete clientModel;
clientModel = 0; clientModel = 0;
StartShutdown();
// Request shutdown from core thread // Request shutdown from core thread
Q_EMIT requestedShutdown(); Q_EMIT requestedShutdown();
} }
+2
View File
@@ -4099,6 +4099,8 @@ bool LoadMempool(void)
} else { } else {
++skipped; ++skipped;
} }
if (ShutdownRequested())
return false;
} }
std::map<uint256, CAmount> mapDeltas; std::map<uint256, CAmount> mapDeltas;
file >> mapDeltas; file >> mapDeltas;