~ 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. */
| 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. */ |
| 291 | static 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 | |
| 314 | static struct io_plan *dns_read_init(struct io_conn *conn, |
| 315 | struct dns_lookup *lookup) |
nothing calls this directly
no test coverage detected