MCPcopy Create free account
hub / github.com/ElementsProject/lightning / write_to_subd

Function write_to_subd

connectd/multiplex.c:1011–1035  ·  view source on GitHub ↗

These four function handle peer->subd */

Source from the content-addressed store, hash-verified

1009
1010/* These four function handle peer->subd */
1011static struct io_plan *write_to_subd(struct io_conn *subd_conn,
1012 struct subd *subd)
1013{
1014 const u8 *msg;
1015 assert(subd->conn == subd_conn);
1016
1017 /* Pop tail of send queue */
1018 msg = msg_dequeue(subd->outq);
1019
1020 /* Nothing to send? */
1021 if (!msg) {
1022 /* If peer is closed, close this. */
1023 if (!subd->peer->to_peer)
1024 return io_close(subd_conn);
1025
1026 /* Tell them to read again. */
1027 io_wake(&subd->peer->peer_in);
1028
1029 /* Wait for them to wake us */
1030 return msg_queue_wait(subd_conn, subd->outq,
1031 write_to_subd, subd);
1032 }
1033
1034 return io_write_wire(subd_conn, take(msg), write_to_subd, subd);
1035}
1036
1037static void destroy_subd(struct subd *subd)
1038{

Callers 1

subd_conn_initFunction · 0.85

Calls 3

msg_dequeueFunction · 0.85
io_closeFunction · 0.85
io_wakeFunction · 0.85

Tested by

no test coverage detected