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

Function connection_out

connectd/connectd.c:582–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582struct io_plan *connection_out(struct io_conn *conn, struct connecting *connect)
583{
584 struct pubkey outkey;
585 struct oneshot *timeout;
586
587 /* This shouldn't happen: lightningd should not give invalid ids! */
588 if (!pubkey_from_node_id(&outkey, &connect->id)) {
589 status_broken("Connection out to invalid id %s",
590 type_to_string(tmpctx, struct node_id,
591 &connect->id));
592 return io_close(conn);
593 }
594
595 /* If they don't complete handshake in reasonable time, hang up */
596 timeout = new_reltimer(&connect->daemon->timers, conn,
597 time_from_sec(connect->daemon->timeout_secs),
598 conn_timeout, conn);
599 status_peer_debug(&connect->id, "Connected out, starting crypto");
600
601 connect->connstate = "Cryptographic handshake";
602 return initiator_handshake(conn, &connect->daemon->mykey, &outkey,
603 &connect->addrs[connect->addrnum],
604 timeout, handshake_out_success, connect);
605}
606
607/*~ When we've exhausted all addresses without success, we come here.
608 *

Callers 2

connect_finish2Function · 0.85
connect_finishFunction · 0.85

Calls 4

io_closeFunction · 0.85
time_from_secFunction · 0.85
pubkey_from_node_idFunction · 0.50
type_to_stringClass · 0.50

Tested by

no test coverage detected