We get notified if a plugin was killed while it was part of a call * chain. If it was still to be called we just remove it from the list, * otherwise it was the plugin that was currently handling the hook call, and * we need to fail over to the next plugin. */
| 115 | * we need to fail over to the next plugin. |
| 116 | */ |
| 117 | static void plugin_hook_killed(struct plugin_hook_call_link *link) |
| 118 | { |
| 119 | struct plugin_hook_call_link *head; |
| 120 | |
| 121 | head = list_top(&link->req->call_chain, struct plugin_hook_call_link, |
| 122 | list); |
| 123 | |
| 124 | /* If we are the head of the call chain, then the plugin died while it |
| 125 | * was handling the hook call. Pretend it didn't get the memo by |
| 126 | * calling the next one instead. This is correct since it is |
| 127 | * equivalent to the plugin dying before the hook invokation, assuming |
| 128 | * the plugin has not commmitted any changes internally. This is the |
| 129 | * weakest assumption we can make short of restarting the plugin and |
| 130 | * calling the hook again (potentially crashing the plugin the same |
| 131 | * way again. |
| 132 | */ |
| 133 | if (link == head) { |
| 134 | /* Call next will unlink, so we don't need to. This is treated |
| 135 | * equivalent to the plugin returning a continue-result. |
| 136 | */ |
| 137 | plugin_hook_callback(NULL, NULL, NULL, link->req); |
| 138 | } else { |
| 139 | /* The plugin is in the list waiting to be called, just remove |
| 140 | * it from the list. */ |
| 141 | list_del(&link->list); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | bool plugin_hook_continue(void *unused, const char *buffer, const jsmntok_t *toks) |
| 146 | { |
nothing calls this directly
no test coverage detected