forked from bitcoin/bitcoin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernel: Remove shutdown from kernel library
This decouples the libbitcoinkernel library from the shutdown routines. As a library, it should not directly rely on code that manages the termination of processes. While touching the lines around StartShutdown, it became apparent that there was no logging indicating the reason for a call to StartShutdown. Add ShutdownReason enum to the startShutdown notification to communicate this.
- Loading branch information
1 parent
2db5ddf
commit a6a3c32
Showing
9 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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 <kernel/notifications_interface.h> | ||
|
||
#include <string> | ||
|
||
namespace kernel { | ||
|
||
std::string ShutdownReasonToString(ShutdownReason reason) | ||
{ | ||
switch (reason) { | ||
case kernel::ShutdownReason::FailedConnectingBestBlock: | ||
return "Failed connecting best block."; | ||
case kernel::ShutdownReason::StopAfterBlockImport: | ||
return "Stopping after block import."; | ||
case kernel::ShutdownReason::StopAtHeight: | ||
return "Reached block height specified by stop at height."; | ||
} // no default case, so the compiler can warn about missing cases | ||
assert(false); | ||
} | ||
|
||
} // namespace kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters