MCPcopy Create free account
hub / github.com/ElementsProject/lightning / daemon_conn_write_next

Function daemon_conn_write_next

common/daemon_conn.c:67–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static 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
93bool daemon_conn_sync_flush(struct daemon_conn *dc)
94{

Callers

nothing calls this directly

Calls 3

msg_dequeueFunction · 0.85
msg_extract_fdFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected