Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.cpp
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
static UniValue stop(const Config &config, const JSONRPCRequest &jsonRequest) { | static UniValue stop(const Config &config, const JSONRPCRequest &jsonRequest) { | ||||
// Accept the deprecated and ignored 'detach' boolean argument | // Accept the deprecated and ignored 'detach' boolean argument | ||||
// Also accept the hidden 'wait' integer argument (milliseconds) | // Also accept the hidden 'wait' integer argument (milliseconds) | ||||
// For instance, 'stop 1000' makes the call wait 1 second before returning | // For instance, 'stop 1000' makes the call wait 1 second before returning | ||||
// to the client (intended for testing) | // to the client (intended for testing) | ||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { | if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"stop", | "stop", | ||||
"Stop Bitcoin server.", | "\nRequest a graceful shutdown of " PACKAGE_NAME ".", | ||||
{}, | {}, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{""}, | RPCExamples{""}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
// 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(); | StartShutdown(); | ||||
if (jsonRequest.params[0].isNum()) { | if (jsonRequest.params[0].isNum()) { | ||||
UninterruptibleSleep( | UninterruptibleSleep( | ||||
std::chrono::milliseconds{jsonRequest.params[0].get_int()}); | std::chrono::milliseconds{jsonRequest.params[0].get_int()}); | ||||
} | } | ||||
return "Bitcoin server stopping"; | return PACKAGE_NAME " stopping"; | ||||
} | } | ||||
static UniValue uptime(const Config &config, const JSONRPCRequest &request) { | static UniValue uptime(const Config &config, const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"uptime", | "uptime", | ||||
"Returns the total uptime of the server.\n", | "Returns the total uptime of the server.\n", | ||||
{}, | {}, | ||||
RPCResult{"ttt (numeric) The number of seconds that the server " | RPCResult{"ttt (numeric) The number of seconds that the server " | ||||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |