| 65 | } |
| 66 | |
| 67 | static struct io_plan *daemon_conn_write_next(struct io_conn *conn, |
| 68 | struct daemon_conn *dc) |
| 69 | { |
| 70 | const u8 *msg; |
| 71 | |
| 72 | msg = msg_dequeue(dc->out); |
| 73 | |
| 74 | /* If nothing in queue, give empty callback a chance to queue somthing */ |
| 75 | if (!msg && dc->outq_empty) { |
| 76 | dc->outq_empty(dc->arg); |
| 77 | msg = msg_dequeue(dc->out); |
| 78 | } |
| 79 | |
| 80 | if (msg) { |
| 81 | int fd = msg_extract_fd(dc->out, msg); |
| 82 | if (fd >= 0) { |
| 83 | tal_free(msg); |
| 84 | return io_send_fd(conn, fd, true, |
| 85 | daemon_conn_write_next, dc); |
| 86 | } |
| 87 | return io_write_wire(conn, take(msg), daemon_conn_write_next, |
| 88 | dc); |
| 89 | } |
| 90 | return msg_queue_wait(conn, dc->out, daemon_conn_write_next, dc); |
| 91 | } |
| 92 | |
| 93 | bool daemon_conn_sync_flush(struct daemon_conn *dc) |
| 94 | { |
nothing calls this directly
no test coverage detected