| 1776 | } |
| 1777 | |
| 1778 | static void call_plugin_timer(struct plugin *p, struct timer *timer) |
| 1779 | { |
| 1780 | struct plugin_timer *t = container_of(timer, struct plugin_timer, timer); |
| 1781 | struct command *timer_cmd; |
| 1782 | struct command_result *res; |
| 1783 | bool cmd_freed = false; |
| 1784 | |
| 1785 | /* This *isn't* owned by timer, which is owned by original command, |
| 1786 | * since they may free that in callback */ |
| 1787 | timer_cmd = new_command(p, p, t->id, "timer", COMMAND_TYPE_TIMER); |
| 1788 | tal_add_destructor2(timer_cmd, destroy_cmd_mark_freed, &cmd_freed); |
| 1789 | |
| 1790 | res = t->cb(timer_cmd, t->cb_arg); |
| 1791 | if (res == &pending) { |
| 1792 | assert(!cmd_freed); |
| 1793 | tal_del_destructor2(timer_cmd, destroy_cmd_mark_freed, |
| 1794 | &cmd_freed); |
| 1795 | } else { |
| 1796 | assert(res == &complete); |
| 1797 | assert(cmd_freed); |
| 1798 | } |
| 1799 | } |
| 1800 | |
| 1801 | static void destroy_plugin_timer(struct plugin_timer *timer, struct plugin *p) |
| 1802 | { |
no test coverage detected