| 382 | } |
| 383 | |
| 384 | static bool log_status_fail(struct subd *sd, const u8 *msg) |
| 385 | { |
| 386 | const char *name = NULL; |
| 387 | enum status_failreason failreason; |
| 388 | char *desc; |
| 389 | |
| 390 | if (!fromwire_status_fail(msg, msg, &failreason, &desc)) |
| 391 | return false; |
| 392 | |
| 393 | /* No 'default:' here so gcc gives warning if a new type added */ |
| 394 | switch (failreason) { |
| 395 | case STATUS_FAIL_MASTER_IO: |
| 396 | name = "STATUS_FAIL_MASTER_IO"; |
| 397 | break; |
| 398 | case STATUS_FAIL_HSM_IO: |
| 399 | name = "STATUS_FAIL_HSM_IO"; |
| 400 | break; |
| 401 | case STATUS_FAIL_GOSSIP_IO: |
| 402 | name = "STATUS_FAIL_GOSSIP_IO"; |
| 403 | break; |
| 404 | case STATUS_FAIL_INTERNAL_ERROR: |
| 405 | name = "STATUS_FAIL_INTERNAL_ERROR"; |
| 406 | break; |
| 407 | } |
| 408 | /* fromwire_status_fail() guarantees it's one of those... */ |
| 409 | assert(name); |
| 410 | |
| 411 | log_broken(sd->log, "%s: %s", name, desc); |
| 412 | |
| 413 | #if DEVELOPER |
| 414 | if (sd->ld->dev_subdaemon_fail) |
| 415 | exit(1); |
| 416 | #endif |
| 417 | return true; |
| 418 | } |
| 419 | |
| 420 | static bool handle_peer_error(struct subd *sd, const u8 *msg, int fds[1]) |
| 421 | { |
no test coverage detected