mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
lightningd/msg_queue: rename msg_is_fd to msg_extract_fd
Suggested-by: Christian Decker Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -18,7 +18,7 @@ struct io_plan *daemon_conn_write_next(struct io_conn *conn,
|
||||
{
|
||||
const u8 *msg = msg_dequeue(&dc->out);
|
||||
if (msg) {
|
||||
int fd = msg_is_fd(msg);
|
||||
int fd = msg_extract_fd(msg);
|
||||
if (fd >= 0)
|
||||
return io_send_fd(conn, fd, true,
|
||||
daemon_conn_write_next, dc);
|
||||
@@ -42,7 +42,7 @@ bool daemon_conn_sync_flush(struct daemon_conn *dc)
|
||||
|
||||
/* Flush existing messages. */
|
||||
while ((msg = msg_dequeue(&dc->out)) != NULL) {
|
||||
int fd = msg_is_fd(msg);
|
||||
int fd = msg_extract_fd(msg);
|
||||
if (fd >= 0) {
|
||||
if (!fdpass_send(io_conn_fd(dc->conn), fd))
|
||||
return false;
|
||||
|
||||
@@ -47,7 +47,7 @@ const u8 *msg_dequeue(struct msg_queue *q)
|
||||
return msg;
|
||||
}
|
||||
|
||||
int msg_is_fd(const u8 *msg)
|
||||
int msg_extract_fd(const u8 *msg)
|
||||
{
|
||||
const u8 *p = msg + sizeof(u16);
|
||||
size_t len = tal_count(msg) - sizeof(u16);
|
||||
|
||||
@@ -25,7 +25,7 @@ void msg_enqueue_fd(struct msg_queue *q, int fd);
|
||||
const u8 *msg_dequeue(struct msg_queue *q);
|
||||
|
||||
/* Returns -1 if not an fd: close after sending. */
|
||||
int msg_is_fd(const u8 *msg);
|
||||
int msg_extract_fd(const u8 *msg);
|
||||
|
||||
#define msg_queue_wait(conn, q, next, arg) \
|
||||
io_out_wait((conn), (q), (next), (arg))
|
||||
|
||||
@@ -309,7 +309,7 @@ static struct io_plan *msg_send_next(struct io_conn *conn, struct subd *sd)
|
||||
if (!msg)
|
||||
return msg_queue_wait(conn, &sd->outq, msg_send_next, sd);
|
||||
|
||||
fd = msg_is_fd(msg);
|
||||
fd = msg_extract_fd(msg);
|
||||
if (fd >= 0) {
|
||||
tal_free(msg);
|
||||
return io_send_fd(conn, fd, true, msg_send_next, sd);
|
||||
|
||||
Reference in New Issue
Block a user