aboutsummaryrefslogtreecommitdiff
path: root/src/node/context.h
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2023-07-07 17:32:54 -0400
committerRyan Ofsky <ryan@ofsky.org>2023-12-04 15:39:15 -0400
commit73133c36aa9cc09546eabac18d0ea35274dd5d72 (patch)
treefdec661ef2a9fdec8b98bd0cbc732ac109a179d9 /src/node/context.h
parentf4a8bd6e2f03e786a84dd7763d1c04665e6371f2 (diff)
downloadbitcoin-73133c36aa9cc09546eabac18d0ea35274dd5d72.tar.xz
refactor: Add NodeContext::shutdown member
Add NodeContext::shutdown variable and start using it to replace the kernel::Context::interrupt variable. The latter can't easily be removed right away but will be removed later in this PR. Moving the interrupt object from the kernel context to the node context increases flexibility of the kernel API so it is possible to use multiple interrupt objects, or avoid creating one if one is not needed. It will also allow getting rid of the kernel::g_context global later in this PR, replacing it with a private SignalInterrupt instance in init.cpp There is no change in behavior in this commit outside of unit tests. In unit tests there should be no visible change either, but internally now each test has its own interrupt variable so the variable will be automatically reset between tests.
Diffstat (limited to 'src/node/context.h')
-rw-r--r--src/node/context.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node/context.h b/src/node/context.h
index dae900ff7f..4f3b640b2d 100644
--- a/src/node/context.h
+++ b/src/node/context.h
@@ -50,6 +50,8 @@ struct NodeContext {
std::unique_ptr<kernel::Context> kernel;
//! Init interface for initializing current process and connecting to other processes.
interfaces::Init* init{nullptr};
+ //! Interrupt object used to track whether node shutdown was requested.
+ util::SignalInterrupt* shutdown{nullptr};
std::unique_ptr<AddrMan> addrman;
std::unique_ptr<CConnman> connman;
std::unique_ptr<CTxMemPool> mempool;