MCPcopy Create free account
hub / github.com/ElementsProject/elements / stop

Function stop

src/rpc/server.cpp:161–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161static 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
187static RPCHelpMan uptime()
188{

Callers

nothing calls this directly

Calls 4

StartShutdownFunction · 0.85
UninterruptibleSleepFunction · 0.85
isNumMethod · 0.80
get_intMethod · 0.80

Tested by

no test coverage detected