| 670 | } |
| 671 | |
| 672 | static struct io_plan *msg_send_next(struct io_conn *conn, struct subd *sd) |
| 673 | { |
| 674 | const u8 *msg; |
| 675 | int fd; |
| 676 | |
| 677 | /* Don't send if we haven't read version! */ |
| 678 | if (!sd->rcvd_version) |
| 679 | return msg_queue_wait(conn, sd->outq, msg_send_next, sd); |
| 680 | |
| 681 | /* Nothing to do? Wait for msg_enqueue. */ |
| 682 | msg = msg_dequeue(sd->outq); |
| 683 | if (!msg) |
| 684 | return msg_queue_wait(conn, sd->outq, msg_send_next, sd); |
| 685 | |
| 686 | fd = msg_extract_fd(sd->outq, msg); |
| 687 | if (fd >= 0) { |
| 688 | tal_free(msg); |
| 689 | return io_send_fd(conn, fd, true, msg_send_next, sd); |
| 690 | } |
| 691 | return io_write_wire(conn, take(msg), msg_send_next, sd); |
| 692 | } |
| 693 | |
| 694 | static struct io_plan *msg_setup(struct io_conn *conn, struct subd *sd) |
| 695 | { |
no test coverage detected