~ connectd's input handler is very simple. */
| 569 | |
| 570 | /*~ connectd's input handler is very simple. */ |
| 571 | static struct io_plan *connectd_req(struct io_conn *conn, |
| 572 | const u8 *msg, |
| 573 | struct daemon *daemon) |
| 574 | { |
| 575 | enum connectd_gossipd_wire t = fromwire_peektype(msg); |
| 576 | |
| 577 | switch (t) { |
| 578 | case WIRE_GOSSIPD_RECV_GOSSIP: |
| 579 | handle_recv_gossip(daemon, msg); |
| 580 | goto handled; |
| 581 | |
| 582 | case WIRE_GOSSIPD_NEW_PEER: |
| 583 | connectd_new_peer(daemon, msg); |
| 584 | goto handled; |
| 585 | |
| 586 | case WIRE_GOSSIPD_PEER_GONE: |
| 587 | connectd_peer_gone(daemon, msg); |
| 588 | goto handled; |
| 589 | |
| 590 | /* We send these, don't receive them. */ |
| 591 | case WIRE_GOSSIPD_SEND_GOSSIP: |
| 592 | break; |
| 593 | } |
| 594 | |
| 595 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 596 | "Bad msg from connectd2: %s", tal_hex(tmpctx, msg)); |
| 597 | |
| 598 | handled: |
| 599 | return daemon_conn_read_next(conn, daemon->connectd); |
| 600 | } |
| 601 | |
| 602 | /* BOLT #7: |
| 603 | * |
nothing calls this directly
no test coverage detected