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

Function dns_resolved

connectd/connectd.c:1115–1134  ·  view source on GitHub ↗

~ 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

Source from the content-addressed store, hash-verified

1113 * results (they go after any remaining announced addresses, exactly as the
1114 * old code's appendings did) and move on. */
1115static 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. */
1137static void try_connect_one_addr(struct connecting *connect)

Callers

nothing calls this directly

Calls 4

tal_append_fmtFunction · 0.85
fmt_wireaddr_internalFunction · 0.85
append_addrFunction · 0.85
try_connect_one_addrFunction · 0.85

Tested by

no test coverage detected