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