mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
lightningd/msg_queue: add msg_wake helper.
A cleaner wrapper than a raw io_wake. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
d967c2ba64
commit
a436fa77fc
@@ -237,9 +237,9 @@ static void wake_pkt_out(struct peer *peer)
|
|||||||
new_reltimer(&peer->daemon->timers, peer, time_from_sec(30),
|
new_reltimer(&peer->daemon->timers, peer, time_from_sec(30),
|
||||||
wake_pkt_out, peer);
|
wake_pkt_out, peer);
|
||||||
/* Notify the peer-write loop */
|
/* Notify the peer-write loop */
|
||||||
io_wake(&peer->peer_out);
|
msg_wake(&peer->peer_out);
|
||||||
/* Notify the daemon_conn-write loop */
|
/* Notify the daemon_conn-write loop */
|
||||||
io_wake(&peer->owner_conn.out);
|
msg_wake(&peer->owner_conn.out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct io_plan *peer_pkt_out(struct io_conn *conn, struct peer *peer)
|
static struct io_plan *peer_pkt_out(struct io_conn *conn, struct peer *peer)
|
||||||
|
|||||||
@@ -57,3 +57,8 @@ int msg_extract_fd(const u8 *msg)
|
|||||||
|
|
||||||
return fromwire_u32(&p, &len);
|
return fromwire_u32(&p, &len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void msg_wake(const struct msg_queue *q)
|
||||||
|
{
|
||||||
|
io_wake(q);
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,12 +15,15 @@ struct msg_queue {
|
|||||||
|
|
||||||
void msg_queue_init(struct msg_queue *q, const tal_t *ctx);
|
void msg_queue_init(struct msg_queue *q, const tal_t *ctx);
|
||||||
|
|
||||||
/* If add is taken(), freed after sending. */
|
/* If add is taken(), freed after sending. msg_wake() implied. */
|
||||||
void msg_enqueue(struct msg_queue *q, const u8 *add);
|
void msg_enqueue(struct msg_queue *q, const u8 *add);
|
||||||
|
|
||||||
/* Fd is closed after sending. */
|
/* Fd is closed after sending. msg_wake() implied. */
|
||||||
void msg_enqueue_fd(struct msg_queue *q, int fd);
|
void msg_enqueue_fd(struct msg_queue *q, int fd);
|
||||||
|
|
||||||
|
/* Explicitly wake up a msg_queue_wait */
|
||||||
|
void msg_wake(const struct msg_queue *q);
|
||||||
|
|
||||||
/* Returns NULL if nothing to do. */
|
/* Returns NULL if nothing to do. */
|
||||||
const u8 *msg_dequeue(struct msg_queue *q);
|
const u8 *msg_dequeue(struct msg_queue *q);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user