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

Function call_plugin_timer

plugins/libplugin.c:1768–1789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1766}
1767
1768static void call_plugin_timer(struct plugin *p, struct timer *timer)
1769{
1770 struct plugin_timer *t = container_of(timer, struct plugin_timer, timer);
1771 struct command *timer_cmd;
1772 struct command_result *res;
1773 bool cmd_freed = false;
1774
1775 /* This *isn't* owned by timer, which is owned by original command,
1776 * since they may free that in callback */
1777 timer_cmd = new_command(p, p, t->id, "timer", COMMAND_TYPE_TIMER);
1778 tal_add_destructor2(timer_cmd, destroy_cmd_mark_freed, &cmd_freed);
1779
1780 res = t->cb(timer_cmd, t->cb_arg);
1781 if (res == &pending) {
1782 assert(!cmd_freed);
1783 tal_del_destructor2(timer_cmd, destroy_cmd_mark_freed,
1784 &cmd_freed);
1785 } else {
1786 assert(res == &complete);
1787 assert(cmd_freed);
1788 }
1789}
1790
1791static void destroy_plugin_timer(struct plugin_timer *timer, struct plugin *p)
1792{

Callers 1

plugin_mainFunction · 0.85

Calls 1

new_commandFunction · 0.85

Tested by

no test coverage detected