mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
refactor: Remove call to StartShutdown from stop RPC
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 returns an RPC error instead.
This commit is contained in:
parent
1d92d89edb
commit
6824eecaf1
1 changed files with 4 additions and 2 deletions
|
@ -8,9 +8,11 @@
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
#include <common/system.h>
|
#include <common/system.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
|
#include <node/context.h>
|
||||||
|
#include <rpc/server_util.h>
|
||||||
#include <rpc/util.h>
|
#include <rpc/util.h>
|
||||||
#include <shutdown.h>
|
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
#include <util/signalinterrupt.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
|
@ -179,7 +181,7 @@ static RPCHelpMan stop()
|
||||||
{
|
{
|
||||||
// Event loop will exit after current HTTP requests have been handled, so
|
// Event loop will exit after current HTTP requests have been handled, so
|
||||||
// this reply will get back to the client.
|
// this reply will get back to the client.
|
||||||
StartShutdown();
|
CHECK_NONFATAL((*CHECK_NONFATAL(EnsureAnyNodeContext(jsonRequest.context).shutdown))());
|
||||||
if (jsonRequest.params[0].isNum()) {
|
if (jsonRequest.params[0].isNum()) {
|
||||||
UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].getInt<int>()});
|
UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].getInt<int>()});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue