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

Function dns_read_reply

connectd/dns.c:291–312  ·  view source on GitHub ↗

~ io callbacks: must not free conn, so anything terminal detaches conn and * returns io_close(). EOF itself is *not* seen here (that fails the conn and * runs its destructor): we're only ever called with lookup->readlen > 0. */

Source from the content-addressed store, hash-verified

289 * returns io_close(). EOF itself is *not* seen here (that fails the conn and
290 * runs its destructor): we're only ever called with lookup->readlen > 0. */
291static struct io_plan *dns_read_reply(struct io_conn *conn,
292 struct dns_lookup *lookup)
293{
294 size_t newlen = lookup->inode + lookup->readlen;
295
296 if (newlen > DNS_PIPE_MAX) {
297 lookup->err = tal_fmt(lookup, "dns resolver returned too many"
298 " addresses");
299 lookup->child = 0; /* Closing will EPIPE it out. */
300 lookup->conn = NULL;
301 dns_finish(lookup);
302 return io_close(conn);
303 }
304
305 tal_resize(&lookup->in, newlen);
306 memcpy(lookup->in + lookup->inode, lookup->readbuf, lookup->readlen);
307 lookup->inode = newlen;
308
309 return io_read_partial(conn, lookup->readbuf,
310 sizeof(lookup->readbuf), &lookup->readlen,
311 dns_read_reply, lookup);
312}
313
314static struct io_plan *dns_read_init(struct io_conn *conn,
315 struct dns_lookup *lookup)

Callers

nothing calls this directly

Calls 2

dns_finishFunction · 0.85
io_closeFunction · 0.85

Tested by

no test coverage detected