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

Function plugin_dynamic_stop

lightningd/plugin_control.c:144–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static struct command_result *
145plugin_dynamic_stop(struct command *cmd, const char *plugin_name)
146{
147 struct plugin *p;
148
149 list_for_each(&cmd->ld->plugins->plugins, p, list) {
150 if (plugin_paths_match(p->cmd, plugin_name)) {
151 if (!p->dynamic)
152 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
153 "%s cannot be managed when "
154 "lightningd is up",
155 plugin_name);
156
157 /* If it's interested in clean shutdown, tell it. */
158 if (notify_plugin_shutdown(cmd->ld, p)) {
159 struct plugin_stop_timeout *pst;
160
161 /* Kill in 30 seconds if it doesn't exit. */
162 pst = tal(p, struct plugin_stop_timeout);
163 pst->p = p;
164 pst->cmd = cmd;
165 notleak(new_reltimer(cmd->ld->timers, pst,
166 time_from_sec(30),
167 plugin_stop_timeout,
168 pst));
169
170 tal_add_destructor2(p, plugin_stopped, cmd);
171 return command_still_pending(cmd);
172 }
173 return plugin_stop(cmd, p, true);
174 }
175 }
176
177 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
178 "Could not find plugin %s", plugin_name);
179}
180
181/**
182 * Look for additions in the default plugin directory.

Callers 1

json_plugin_controlFunction · 0.85

Calls 6

plugin_paths_matchFunction · 0.85
notify_plugin_shutdownFunction · 0.85
time_from_secFunction · 0.85
plugin_stopFunction · 0.85
command_failFunction · 0.70
command_still_pendingFunction · 0.70

Tested by

no test coverage detected