| 186 | } |
| 187 | |
| 188 | static struct command_result *after_listpeerchannels(struct command *cmd, |
| 189 | const char *method, |
| 190 | const char *buf, |
| 191 | const jsmntok_t *params, |
| 192 | void *cb_arg UNUSED) |
| 193 | { |
| 194 | const jsmntok_t *iter, *lost_statetok; |
| 195 | const jsmntok_t *channelstok = json_get_member(buf, params, "channels"); |
| 196 | size_t i; |
| 197 | bool lost_state; |
| 198 | |
| 199 | json_for_each_arr(i, iter, channelstok) { |
| 200 | lost_statetok = json_get_member(buf, iter, "lost_state"); |
| 201 | if (lost_statetok) { |
| 202 | json_to_bool(buf, lost_statetok, &lost_state); |
| 203 | |
| 204 | if (lost_state) { |
| 205 | plugin_log(plugin, LOG_DBG, "Detected a channel with lost state, Entering Recovery mode!"); |
| 206 | recovery = true; |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | if (recovery) { |
| 213 | entering_recovery_mode(cmd); |
| 214 | return command_still_pending(cmd); |
| 215 | } |
| 216 | |
| 217 | lost_state_timer = |
| 218 | global_timer(plugin, time_from_sec(CHECK_PEER_INTERVAL), |
| 219 | do_check_lost_peer, NULL); |
| 220 | return command_still_pending(cmd); |
| 221 | } |
| 222 | |
| 223 | static struct command_result *check_lost_peer(struct command *cmd) |
| 224 | { |
nothing calls this directly
no test coverage detected