This initializes a fresh io_conn by setting it to io_connect to the * SOCKS proxy, as handled in tor.c. */
| 728 | /* This initializes a fresh io_conn by setting it to io_connect to the |
| 729 | * SOCKS proxy, as handled in tor.c. */ |
| 730 | static struct io_plan *conn_proxy_init(struct io_conn *conn, |
| 731 | struct connecting *connect) |
| 732 | { |
| 733 | const char *host = NULL; |
| 734 | u16 port; |
| 735 | const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum]; |
| 736 | |
| 737 | switch (addr->itype) { |
| 738 | case ADDR_INTERNAL_FORPROXY: |
| 739 | host = addr->u.unresolved.name; |
| 740 | port = addr->u.unresolved.port; |
| 741 | break; |
| 742 | case ADDR_INTERNAL_WIREADDR: |
| 743 | host = fmt_wireaddr_without_port(tmpctx, &addr->u.wireaddr); |
| 744 | port = addr->u.wireaddr.port; |
| 745 | break; |
| 746 | case ADDR_INTERNAL_SOCKNAME: |
| 747 | case ADDR_INTERNAL_ALLPROTO: |
| 748 | case ADDR_INTERNAL_AUTOTOR: |
| 749 | case ADDR_INTERNAL_STATICTOR: |
| 750 | break; |
| 751 | } |
| 752 | |
| 753 | if (!host) |
| 754 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 755 | "Can't connect to %u address", addr->itype); |
| 756 | |
| 757 | io_set_finish(conn, destroy_io_conn, connect); |
| 758 | return io_tor_connect(conn, connect->daemon->proxyaddr, host, port, |
| 759 | connect); |
| 760 | } |
| 761 | |
| 762 | /*~ This is the routine which tries to connect. */ |
| 763 | static void try_connect_one_addr(struct connecting *connect) |
nothing calls this directly
no test coverage detected