Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | void Shutdown() { | ||||
// Because these depend on each-other, we make sure that neither can be | // Because these depend on each-other, we make sure that neither can be | ||||
// using the other before destroying them. | // using the other before destroying them. | ||||
if (peerLogic) { | if (peerLogic) { | ||||
UnregisterValidationInterface(peerLogic.get()); | UnregisterValidationInterface(peerLogic.get()); | ||||
} | } | ||||
if (g_connman) { | if (g_connman) { | ||||
g_connman->Stop(); | g_connman->Stop(); | ||||
} | } | ||||
peerLogic.reset(); | |||||
g_connman.reset(); | |||||
if (g_txindex) { | if (g_txindex) { | ||||
g_txindex.reset(); | g_txindex->Stop(); | ||||
} | } | ||||
StopTorControl(); | StopTorControl(); | ||||
// After everything has been shut down, but before things get flushed, stop | // After everything has been shut down, but before things get flushed, stop | ||||
// the CScheduler/checkqueue threadGroup | // the CScheduler/checkqueue threadGroup | ||||
threadGroup.interrupt_all(); | threadGroup.interrupt_all(); | ||||
threadGroup.join_all(); | threadGroup.join_all(); | ||||
// After the threads that potentially access these pointers have been | |||||
// stopped, destruct and reset all to nullptr. | |||||
peerLogic.reset(); | |||||
g_connman.reset(); | |||||
g_txindex.reset(); | |||||
if (g_is_mempool_loaded && | if (g_is_mempool_loaded && | ||||
gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | ||||
DumpMempool(); | DumpMempool(); | ||||
} | } | ||||
// FlushStateToDisk generates a ChainStateFlushed callback, which we should | // FlushStateToDisk generates a ChainStateFlushed callback, which we should | ||||
// avoid missing | // avoid missing | ||||
if (pcoinsTip != nullptr) { | if (pcoinsTip != nullptr) { | ||||
▲ Show 20 Lines • Show All 2,229 Lines • Show Last 20 Lines |