From f747ad8f73b6a9a9ef11d24f8480a82656e211e3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 24 Jul 2018 15:48:40 +0930 Subject: [PATCH] common/daemon_conn: add daemon_conn_wake() helper. We've been open-coding it. Signed-off-by: Rusty Russell --- common/daemon_conn.c | 5 +++++ common/daemon_conn.h | 5 +++++ gossipd/gossip.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/daemon_conn.c b/common/daemon_conn.c index 95882eb81..d41d4952d 100644 --- a/common/daemon_conn.c +++ b/common/daemon_conn.c @@ -104,3 +104,8 @@ void daemon_conn_send_fd(struct daemon_conn *dc, int fd) { msg_enqueue_fd(&dc->out, fd); } + +void daemon_conn_wake(struct daemon_conn *dc) +{ + msg_wake(&dc->out); +} diff --git a/common/daemon_conn.h b/common/daemon_conn.h index 76ea57df9..89fe13c4d 100644 --- a/common/daemon_conn.h +++ b/common/daemon_conn.h @@ -57,6 +57,11 @@ void daemon_conn_clear(struct daemon_conn *dc); */ void daemon_conn_send(struct daemon_conn *dc, const u8 *msg); +/** + * daemon_conn_wake - Wake queue (fires msg_queue_cleared_cb if queue empty) + */ +void daemon_conn_wake(struct daemon_conn *dc); + /** * daemon_conn_send_fd - Enqueue a file descriptor to be sent (closed after) */ diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 5b6d036ac..8cdb509c6 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -569,7 +569,7 @@ static void wake_gossip_out(struct peer *peer) msg_wake(&peer->local->peer_out); else if (peer->remote) /* Notify the daemon_conn-write loop */ - msg_wake(&peer->remote->out); + daemon_conn_wake(peer->remote); } static void peer_error(struct peer *peer, const char *fmt, ...) @@ -944,7 +944,7 @@ static void handle_query_short_channel_ids(struct peer *peer, u8 *msg) msg_wake(&peer->local->peer_out); else /* Notify the daemon_conn-write loop */ - msg_wake(&peer->remote->out); + daemon_conn_wake(peer->remote); } static void handle_gossip_timestamp_filter(struct peer *peer, u8 *msg)