mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-22 10:02:34 +02:00

Use SignalInterrupt object instead. There is a slight change in behavior here because the previous StartShutdown code used to abort on failure and the new code logs errors instead.
30 lines
953 B
C++
30 lines
953 B
C++
// Copyright (c) 2023 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <node/abort.h>
|
|
|
|
#include <logging.h>
|
|
#include <node/interface_ui.h>
|
|
#include <util/signalinterrupt.h>
|
|
#include <util/translation.h>
|
|
#include <warnings.h>
|
|
|
|
#include <atomic>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
|
|
namespace node {
|
|
|
|
void AbortNode(util::SignalInterrupt* shutdown, std::atomic<int>& exit_status, const std::string& debug_message, const bilingual_str& user_message)
|
|
{
|
|
SetMiscWarning(Untranslated(debug_message));
|
|
LogPrintf("*** %s\n", debug_message);
|
|
InitError(user_message.empty() ? _("A fatal internal error occurred, see debug.log for details") : user_message);
|
|
exit_status.store(EXIT_FAILURE);
|
|
if (shutdown && !(*shutdown)()) {
|
|
LogPrintf("Error: failed to send shutdown signal\n");
|
|
};
|
|
}
|
|
} // namespace node
|