Skip to content

Commit 6824eec

Browse files
committed
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.
1 parent 1d92d89 commit 6824eec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rpc/server.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
#include <common/args.h>
99
#include <common/system.h>
1010
#include <logging.h>
11+
#include <node/context.h>
12+
#include <rpc/server_util.h>
1113
#include <rpc/util.h>
12-
#include <shutdown.h>
1314
#include <sync.h>
15+
#include <util/signalinterrupt.h>
1416
#include <util/strencodings.h>
1517
#include <util/string.h>
1618
#include <util/time.h>
@@ -179,7 +181,7 @@ static RPCHelpMan stop()
179181
{
180182
// Event loop will exit after current HTTP requests have been handled, so
181183
// this reply will get back to the client.
182-
StartShutdown();
184+
CHECK_NONFATAL((*CHECK_NONFATAL(EnsureAnyNodeContext(jsonRequest.context).shutdown))());
183185
if (jsonRequest.params[0].isNum()) {
184186
UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].getInt<int>()});
185187
}

0 commit comments

Comments
 (0)