MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / Shutdown

Function Shutdown

src/init.cpp:131–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129void Interrupt() { InterruptRPCServer(); }
130
131void Shutdown() {
132 LogPrint(BCLog::INFO, "Shutdown() : In progress...\n");
133 static CCriticalSection cs_Shutdown;
134 TRY_LOCK(cs_Shutdown, lockShutdown);
135 if (!lockShutdown)
136 return;
137
138 RenameThread("coin-shutoff");
139
140 StopRPCServer();
141
142 GenerateProduceBlockThread(false, nullptr, 0);
143 StartCommonGeneration(0, 0);
144 StartContractGeneration("", 0, 0);
145
146 StopNode();
147 UnregisterNodeSignals(GetNodeSignals());
148
149 {
150 LOCK(cs_main);
151
152 if (pWalletMain) {
153 pWalletMain->SetBestChain(chainActive.GetLocator());
154 bitdb.Flush(true);
155 }
156
157 if (pCdMan != nullptr) {
158 pCdMan->Flush();
159 delete pCdMan;
160 pCdMan = nullptr;
161 }
162 }
163
164 boost::filesystem::remove(GetPidFile());
165 UnregisterAllWallets();
166
167 delete pWalletMain;
168 pWalletMain = nullptr;
169
170 // Uninitialize elliptic curve code
171 globalVerifyHandle.reset();
172 ECC_Stop();
173
174 wasm_code_cache_free();
175
176 LogPrint(BCLog::INFO, "Shutdown() : done\n");
177}
178
179//
180// Signal handlers are very limited in what they are allowed to do, so:

Callers 2

mainFunction · 0.85
StopServerMethod · 0.85

Calls 15

RenameThreadFunction · 0.85
StopRPCServerFunction · 0.85
StartCommonGenerationFunction · 0.85
StartContractGenerationFunction · 0.85
StopNodeFunction · 0.85
UnregisterNodeSignalsFunction · 0.85
GetPidFileFunction · 0.85
UnregisterAllWalletsFunction · 0.85
ECC_StopFunction · 0.85
wasm_code_cache_freeFunction · 0.85
SetBestChainMethod · 0.80

Tested by 1

StopServerMethod · 0.68