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

Function json_graceful

lightningd/peer_control.c:3476–3501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3474}
3475
3476static struct command_result *json_graceful(struct command *cmd,
3477 const char *buffer,
3478 const jsmntok_t *obj UNNEEDED,
3479 const jsmntok_t *params)
3480{
3481 struct graceful_waiter *gw = tal(cmd, struct graceful_waiter);
3482 u64 *timeout;
3483
3484 if (!param(cmd, buffer, params,
3485 p_opt("timeout", param_u64, &timeout),
3486 NULL))
3487 return command_param_failed();
3488
3489 log_unusual(cmd->ld->log, "JSON-RPC graceful: preventing more connections");
3490 cmd->ld->state = LD_STATE_GRACE;
3491
3492 gw->cmd = cmd;
3493 gw->last_msg = NULL;
3494 if (timeout)
3495 gw->timeout = new_reltimer(cmd->ld->timers, gw,
3496 time_from_sec(*timeout),
3497 graceful_timeout, gw);
3498 list_add_tail(&cmd->ld->graceful_commands, &gw->list);
3499 tal_add_destructor(gw, destroy_graceful_waiter);
3500 return check_graceful_shutdown_progress(cmd->ld, cmd);
3501}
3502
3503static const struct json_command graceful_command = {
3504 "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