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

Function send_pending_client_fd

hsmd/hsmd.c:495–515  ·  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

493/*~ This is the callback from below: having sent the reply, we now send the
494 * fd for the client end of the new socketpair. */
495static struct io_plan *send_pending_client_fd(struct io_conn *conn,
496 struct client *master)
497{
498 int fd = pending_client_fd;
499 /* This must be the master. */
500 assert(is_lightningd(master));
501 assert(fd != -1);
502
503 /* This sanity check shouldn't be necessary, but it's cheap. */
504 pending_client_fd = -1;
505
506 /*~There's arcane UNIX magic to send an open file descriptor over a
507 * UNIX domain socket. There's no great way to autogenerate this
508 * though; especially for the receive side, so we always pass these
509 * manually immediately following the message.
510 *
511 * io_send_fd()'s third parameter is whether to close the local one
512 * after sending; that saves us YA callback.
513 */
514 return io_send_fd(conn, fd, true, client_read_next, master);
515}
516
517/*~ This is used by the master to create a new client connection (which
518 * 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