mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
torcontrol: Move tor controller into node context
Co-authored-by: sedited <seb.kung@gmail.com>
This commit is contained in:
11
src/init.cpp
11
src/init.cpp
@@ -276,7 +276,9 @@ void Interrupt(NodeContext& node)
|
||||
InterruptHTTPRPC();
|
||||
InterruptRPC();
|
||||
InterruptREST();
|
||||
InterruptTorControl();
|
||||
if (node.tor_controller) {
|
||||
node.tor_controller->Interrupt();
|
||||
}
|
||||
InterruptMapPort();
|
||||
if (node.connman)
|
||||
node.connman->Interrupt();
|
||||
@@ -319,7 +321,10 @@ void Shutdown(NodeContext& node)
|
||||
if (node.peerman && node.validation_signals) node.validation_signals->UnregisterValidationInterface(node.peerman.get());
|
||||
if (node.connman) node.connman->Stop();
|
||||
|
||||
StopTorControl();
|
||||
if (node.tor_controller) {
|
||||
node.tor_controller->Join();
|
||||
node.tor_controller.reset();
|
||||
}
|
||||
|
||||
if (node.background_init_thread.joinable()) node.background_init_thread.join();
|
||||
// After everything has been shut down, but before things get flushed, stop the
|
||||
@@ -2187,7 +2192,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
"for the automatically created Tor onion service."),
|
||||
onion_service_target.ToStringAddrPort()));
|
||||
}
|
||||
StartTorControl(onion_service_target);
|
||||
node.tor_controller = std::make_unique<TorController>(gArgs.GetArg("-torcontrol", DEFAULT_TOR_CONTROL), onion_service_target);
|
||||
}
|
||||
|
||||
if (connOptions.bind_on_any) {
|
||||
|
||||
Reference in New Issue
Block a user