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

Function connection_in

connectd/connectd.c:648–675  ·  view source on GitHub ↗

~ When we get a direct connection in we set up its network address * then call handshake.c to set up the crypto state. */

Source from the content-addressed store, hash-verified

646/*~ When we get a direct connection in we set up its network address
647 * then call handshake.c to set up the crypto state. */
648static struct io_plan *connection_in(struct io_conn *conn,
649 struct daemon *daemon)
650{
651 struct conn_in conn_in_arg;
652
653 /* Did we fail to accept? */
654 if (!conn) {
655 static bool accept_logged = false;
656 status_broken_once(&accept_logged,
657 "accepting incoming fd failed: %s",
658 strerror(errno));
659 /* Maybe free up some fds by closing something. */
660 close_random_connection(daemon);
661 return NULL;
662 }
663
664 conn_in_arg.addr.u.wireaddr.is_websocket = false;
665 if (!get_remote_address(conn, &conn_in_arg.addr))
666 return io_close(conn);
667
668 /* Don't try to set TCP options on UNIX socket! */
669 if (conn_in_arg.addr.itype == ADDR_INTERNAL_WIREADDR)
670 set_tcp_no_delay(daemon, io_conn_fd(conn));
671
672 conn_in_arg.daemon = daemon;
673 conn_in_arg.is_websocket = false;
674 return conn_in(conn, &conn_in_arg);
675}
676
677/*~ <hello>I speak web socket</hello>.
678 *

Callers

nothing calls this directly

Calls 6

close_random_connectionFunction · 0.85
get_remote_addressFunction · 0.85
io_closeFunction · 0.85
set_tcp_no_delayFunction · 0.85
io_conn_fdFunction · 0.85
conn_inFunction · 0.70

Tested by

no test coverage detected