From e7b1a874fcb05376eec0609d8d8f329248673d42 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 6 Feb 2026 16:10:34 -0500 Subject: [PATCH 1/2] Parse http basic auth for bitcoind compat. --- src/parser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/parser.cpp b/src/parser.cpp index 61c4f460..64947721 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1027,6 +1027,16 @@ options_metadata parser::load_settings() THROWS value(&configured.server.bitcoind.key_pass), "The password to decrypt the server private key file (.PEM), optional." ) + ( + "bitcoind.username", + value(&configured.server.bitcoind.username), + "The http basic authorization username (not secure)." + ) + ( + "bitcoind.password", + value(&configured.server.bitcoind.password), + "The http basic authorization password (not secure)." + ) ( "bitcoind.connections", value(&configured.server.bitcoind.connections), From 10296c67f79b66413773dce7cee0c10010af5b09 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 7 Feb 2026 01:19:13 -0500 Subject: [PATCH 2/2] Fix shutdown polling for non-run commands. --- console/executor.cpp | 33 +++++++++++++++++++++------------ console/executor.hpp | 3 ++- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/console/executor.cpp b/console/executor.cpp index 7c677c52..ac10c581 100644 --- a/console/executor.cpp +++ b/console/executor.cpp @@ -33,10 +33,10 @@ using namespace system; using namespace std::placeholders; // static initializers. -std::thread executor::stop_poller_{}; std::promise executor::stopping_{}; std::atomic executor::initialized_{}; std::atomic executor::signal_{ unsignalled }; +std::unique_ptr executor::stop_poller_{}; executor::executor(parser& metadata, std::istream& input, std::ostream& output, std::ostream&) @@ -59,9 +59,6 @@ executor::executor(parser& metadata, std::istream& input, std::ostream& output, metadata.configured.log.verbose } { - BC_ASSERT(!initialized_); - initialized_ = true; - initialize_stop(); #if defined(HAVE_MSC) @@ -71,11 +68,11 @@ executor::executor(parser& metadata, std::istream& input, std::ostream& output, executor::~executor() { - initialized_ = false; - #if defined(HAVE_MSC) destroy_hidden_window(); #endif + + uninitialize_stop(); } // Stop signal. @@ -112,6 +109,9 @@ BOOL WINAPI executor::control_handler(DWORD signal) void executor::initialize_stop() { + BC_ASSERT(!initialized_); + initialized_ = true; + poll_for_stopping(); #if defined(HAVE_MSC) @@ -146,6 +146,19 @@ void executor::initialize_stop() #endif } +void executor::uninitialize_stop() +{ + BC_ASSERT(initialized_); + initialized_ = false; + + stop(); + if (stop_poller_ && stop_poller_->joinable()) + { + stop_poller_->join(); + stop_poller_.reset(); + } +} + // Handle the stop signal and invoke stop method (requries signal safe code). void executor::handle_stop(int signal) { @@ -179,12 +192,10 @@ bool executor::canceled() // Spinning must be used in signal handler, cannot wait on a promise. void executor::poll_for_stopping() { - using namespace std::this_thread; - - stop_poller_ = std::thread([]() + stop_poller_ = std::make_unique([]() { while (!canceled()) - sleep_for(std::chrono::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); stopping_.set_value(true); }); @@ -194,8 +205,6 @@ void executor::poll_for_stopping() void executor::wait_for_stopping() { stopping_.get_future().wait(); - if (stop_poller_.joinable()) - stop_poller_.join(); } // Suspend verbose logging and log the stop signal. diff --git a/console/executor.hpp b/console/executor.hpp index 6ec47168..a995b531 100644 --- a/console/executor.hpp +++ b/console/executor.hpp @@ -53,6 +53,7 @@ class executor // Executor (static). static void initialize_stop(); + static void uninitialize_stop(); static void poll_for_stopping(); static void wait_for_stopping(); static void handle_stop(int code); @@ -171,10 +172,10 @@ class executor static const std::unordered_map fired_; // Shutdown. - static std::thread stop_poller_; static std::atomic signal_; static std::atomic initialized_; static std::promise stopping_; + static std::unique_ptr stop_poller_; std::promise log_suspended_{}; parser& metadata_;