aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-04-04 22:50:40 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-04-06 17:12:32 +0300
commit7fcdec0f326f7fb547ec9c651871842cf518ea38 (patch)
treea195b3b890bf69347cf740ef4c9c2f48f57841c6
parentc8971547d9c9460fcbec6f54888df83f002c3dfd (diff)
Remove PID file at the very end
-rw-r--r--src/init.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 88caed9ded..076e2ceacf 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -278,13 +278,6 @@ void Shutdown(NodeContext& node)
}
#endif
- try {
- if (!fs::remove(GetPidFile())) {
- LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
- }
- } catch (const fs::filesystem_error& e) {
- LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
- }
node.chain_clients.clear();
UnregisterAllValidationInterfaces();
GetMainSignals().UnregisterBackgroundSignalScheduler();
@@ -292,6 +285,15 @@ void Shutdown(NodeContext& node)
ECC_Stop();
if (node.mempool) node.mempool = nullptr;
node.scheduler.reset();
+
+ try {
+ if (!fs::remove(GetPidFile())) {
+ LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
+ }
+ } catch (const fs::filesystem_error& e) {
+ LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
+ }
+
LogPrintf("%s: done\n", __func__);
}