~ Resolving a DNS address used to be a synchronous getaddrinfo() right * here: a slow or unresponsive nameserver would then hold up every peer * on the box for the duration of the lookup. Now the lookup is forked * off, and we come back here from the io loop when it's done: append the * results (they go after any remaining announced addresses, exactly as the * old code's appendings did) and
| 1113 | * results (they go after any remaining announced addresses, exactly as the |
| 1114 | * old code's appendings did) and move on. */ |
| 1115 | static void dns_resolved(void *arg, const struct wireaddr *addrs, |
| 1116 | const char *err) |
| 1117 | { |
| 1118 | struct connecting *connect = arg; |
| 1119 | const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum]; |
| 1120 | |
| 1121 | if (err) { |
| 1122 | tal_append_fmt(&connect->errors, |
| 1123 | "%s: %s. ", |
| 1124 | fmt_wireaddr_internal(tmpctx, addr), err); |
| 1125 | } else { |
| 1126 | for (size_t i = 0; i < tal_count(addrs); i++) |
| 1127 | append_addr(&connect->addrs, &addrs[i]); |
| 1128 | } |
| 1129 | |
| 1130 | /* This causes the same very limited recursion as `goto next` below, |
| 1131 | * from a safe (timer) context. */ |
| 1132 | connect->addrnum++; |
| 1133 | try_connect_one_addr(connect); |
| 1134 | } |
| 1135 | |
| 1136 | /*~ This is the routine which tries to connect. */ |
| 1137 | static void try_connect_one_addr(struct connecting *connect) |
nothing calls this directly
no test coverage detected