common/daemon_conn: add daemon_conn_wake() helper.

We've been open-coding it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-07-24 15:48:40 +09:30
parent 16b8f1eb83
commit f747ad8f73
3 changed files with 12 additions and 2 deletions

View File

@ -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);
}

View File

@ -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)
*/

View File

@ -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)