~ This is the destructor for the (unsuccessful) outgoing connection. We accumulate * the errors which occurred, so we can report to lightningd properly in case * they all fail, and try the next address. * * This is a specialized form of destructor which takes an extra argument; * it set up by either the creatively-named tal_add_destructor2(), or by * the ccan/io's io_set_finish() on a conne
| 657 | * it set up by either the creatively-named tal_add_destructor2(), or by |
| 658 | * the ccan/io's io_set_finish() on a connection. */ |
| 659 | static void destroy_io_conn(struct io_conn *conn, struct connecting *connect) |
| 660 | { |
| 661 | /*~ tal_append_fmt appends to a tal string. It's terribly convenient */ |
| 662 | const char *errstr = strerror(errno); |
| 663 | /* errno 0 means they hung up on us. */ |
| 664 | if (errno == 0) { |
| 665 | errstr = "peer closed connection"; |
| 666 | if (streq(connect->connstate, "Cryptographic handshake")) |
| 667 | errstr = "peer closed connection (wrong key?)"; |
| 668 | } |
| 669 | |
| 670 | add_errors_to_error_list(connect, |
| 671 | tal_fmt(tmpctx, "%s: %s: %s", |
| 672 | type_to_string(tmpctx, struct wireaddr_internal, |
| 673 | &connect->addrs[connect->addrnum]), |
| 674 | connect->connstate, errstr)); |
| 675 | connect->addrnum++; |
| 676 | connect->conn = NULL; |
| 677 | try_connect_one_addr(connect); |
| 678 | } |
| 679 | |
| 680 | /* This initializes a fresh io_conn by setting it to io_connect to the |
| 681 | * destination */ |
nothing calls this directly
no test coverage detected