daemon_conn: helper to release daemon_conn.
We'll want this for the next change, where gossipd migrates remote peers back to local ones. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
8ed511b3c7
commit
0cab9d1dd1
|
@ -87,6 +87,12 @@ void daemon_conn_init(tal_t *ctx, struct daemon_conn *dc, int fd,
|
|||
io_set_finish(conn, finish, dc);
|
||||
}
|
||||
|
||||
void daemon_conn_clear(struct daemon_conn *dc)
|
||||
{
|
||||
io_set_finish(dc->conn, NULL, NULL);
|
||||
io_close(dc->conn);
|
||||
}
|
||||
|
||||
void daemon_conn_send(struct daemon_conn *dc, const u8 *msg)
|
||||
{
|
||||
msg_enqueue(&dc->out, msg);
|
||||
|
|
|
@ -43,6 +43,16 @@ void daemon_conn_init(tal_t *ctx, struct daemon_conn *dc, int fd,
|
|||
struct io_plan *(*daemon_conn_recv)(
|
||||
struct io_conn *, struct daemon_conn *),
|
||||
void (*finish)(struct io_conn *, struct daemon_conn *));
|
||||
|
||||
/**
|
||||
* daemon_conn_clear - discard a daemon conn without triggering finish.
|
||||
* @dc: the daemon_conn to clean up.
|
||||
*
|
||||
* This is used by gossipd when a peer is handed back, and we no longer
|
||||
* want to deal with it via daemon_conn. @dc must not be used after this!
|
||||
*/
|
||||
void daemon_conn_clear(struct daemon_conn *dc);
|
||||
|
||||
/**
|
||||
* daemon_conn_send - Enqueue an outgoing message to be sent
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue