# std.net.HostName.connect: rework to avoid waiting for DNS · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/adaef433d24ce88230fe64ce20214d695cf83bc0)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: adaef433d24ce88230fe64ce20214d695cf83bc0

Requested commit: adaef433d24ce88230fe64ce20214d695cf83bc0

Commit: adaef433d24ce88230fe64ce20214d695cf83bc0

Tree: 51ade56232fc8d0a75bc31d20788c45d9217d8cb

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.net.HostName.connect: rework to avoid waiting for DNS

The previous implementation would eagerly attempt TCP connection upon
receiving a DNS reply, but it would still wait for all the DNS results
before returning from the function.

This implementation returns immediately upon first successful TCP
connection, canceling not only in-flight TCP connection attempts but
also unfinished DNS queries.

```

## Parents

- [d3c4158a1053e5322d137f61bf4bc643650a4741](https://git.cafe/gitcafe/zig/commit/d3c4158a1053e5322d137f61bf4bc643650a4741?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/adaef433d24ce88230fe64ce20214d695cf83bc0?format=markdown)
