MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_graceful

Function json_graceful

lightningd/peer_control.c:3198–3223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3196}
3197
3198static struct command_result *json_graceful(struct command *cmd,
3199 const char *buffer,
3200 const jsmntok_t *obj UNNEEDED,
3201 const jsmntok_t *params)
3202{
3203 struct graceful_waiter *gw = tal(cmd, struct graceful_waiter);
3204 u64 *timeout;
3205
3206 if (!param(cmd, buffer, params,
3207 p_opt("timeout", param_u64, &timeout),
3208 NULL))
3209 return command_param_failed();
3210
3211 log_unusual(cmd->ld->log, "JSON-RPC graceful: preventing more connections");
3212 cmd->ld->state = LD_STATE_GRACE;
3213
3214 gw->cmd = cmd;
3215 gw->last_msg = NULL;
3216 if (timeout)
3217 gw->timeout = new_reltimer(cmd->ld->timers, gw,
3218 time_from_sec(*timeout),
3219 graceful_timeout, gw);
3220 list_add_tail(&cmd->ld->graceful_commands, &gw->list);
3221 tal_add_destructor(gw, destroy_graceful_waiter);
3222 return check_graceful_shutdown_progress(cmd->ld, cmd);
3223}
3224
3225static const struct json_command graceful_command = {
3226 "graceful",

Callers

nothing calls this directly

Calls 4

time_from_secFunction · 0.85
command_param_failedFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected