Skip to content

Commit

Permalink
common/daemon_conn: add daemon_conn_wake() helper.
Browse files Browse the repository at this point in the history
We've been open-coding it.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jul 25, 2018
1 parent 16b8f1e commit f747ad8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions common/daemon_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions common/daemon_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down
4 changes: 2 additions & 2 deletions gossipd/gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f747ad8

Please sign in to comment.