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

Function send_pending_client_fd

hsmd/hsmd.c:577–597  ·  view source on GitHub ↗

~ This is the callback from below: having sent the reply, we now send the * fd for the client end of the new socketpair. */

Source from the content-addressed store, hash-verified

575/*~ This is the callback from below: having sent the reply, we now send the
576 * fd for the client end of the new socketpair. */
577static struct io_plan *send_pending_client_fd(struct io_conn *conn,
578 struct client *master)
579{
580 int fd = pending_client_fd;
581 /* This must be the master. */
582 assert(is_lightningd(master));
583 assert(fd != -1);
584
585 /* This sanity check shouldn't be necessary, but it's cheap. */
586 pending_client_fd = -1;
587
588 /*~There's arcane UNIX magic to send an open file descriptor over a
589 * UNIX domain socket. There's no great way to autogenerate this
590 * though; especially for the receive side, so we always pass these
591 * manually immediately following the message.
592 *
593 * io_send_fd()'s third parameter is whether to close the local one
594 * after sending; that saves us YA callback.
595 */
596 return io_send_fd(conn, fd, true, client_read_next, master);
597}
598
599/*~ This is used by the master to create a new client connection (which
600 * becomes the HSM_FD for the subdaemon after forking). */

Callers

nothing calls this directly

Calls 1

is_lightningdFunction · 0.85

Tested by

no test coverage detected