| 159 | } |
| 160 | |
| 161 | static RPCHelpMan stop() |
| 162 | { |
| 163 | static const std::string RESULT{PACKAGE_NAME " stopping"}; |
| 164 | return RPCHelpMan{"stop", |
| 165 | // Also accept the hidden 'wait' integer argument (milliseconds) |
| 166 | // For instance, 'stop 1000' makes the call wait 1 second before returning |
| 167 | // to the client (intended for testing) |
| 168 | "\nRequest a graceful shutdown of " PACKAGE_NAME ".", |
| 169 | { |
| 170 | {"wait", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "how long to wait in ms", "", {}, /* hidden */ true}, |
| 171 | }, |
| 172 | RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"}, |
| 173 | RPCExamples{""}, |
| 174 | [&](const RPCHelpMan& self, const JSONRPCRequest& jsonRequest) -> UniValue |
| 175 | { |
| 176 | // Event loop will exit after current HTTP requests have been handled, so |
| 177 | // this reply will get back to the client. |
| 178 | StartShutdown(); |
| 179 | if (jsonRequest.params[0].isNum()) { |
| 180 | UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].get_int()}); |
| 181 | } |
| 182 | return RESULT; |
| 183 | }, |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | static RPCHelpMan uptime() |
| 188 | { |
nothing calls this directly
no test coverage detected