27 Commits

Author SHA1 Message Date
Andrew Kelley
adaef433d2 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.
2025-10-29 06:20:49 -07:00
Andrew Kelley
d3c4158a10 std.Io: implement Select
and finish implementation of HostName.connect
2025-10-29 06:20:49 -07:00
Andrew Kelley
35ce907c06 std.Io.net.HostName: move lookup to the interface
Unfortunately this can't be implemented "above the vtable" because
various operating systems don't provide low level DNS resolution
primitives such as just putting the list of nameservers in a file.

Without libc on Linux it works great though!

Anyway this also changes the API to be based on Io.Queue. By using a
large enough buffer, reusable code can be written that does not require
concurrent, yet takes advantage of responding to DNS queries as they
come in. I sketched out a new implementation of `HostName.connect` to
demonstrate this, but it will require an additional API (`Io.Select`) to
be implemented in a future commit.

This commit also introduces "uncancelable" variants for mutex locking,
waiting on a condition, and putting items into a queue.
2025-10-29 06:20:49 -07:00
Andrew Kelley
e8cea8accb std.Io.Threaded: implement netListenUnix 2025-10-29 06:20:49 -07:00
Andrew Kelley
539808239e std.net: IPv6 parsing fixes 2025-10-29 06:20:49 -07:00
Andrew Kelley
d3f0c460ec std.Io.net.HostName: fix DNS resolution
* merge conflict with changing behavior of takeDelimiterExclusive
* check bounds before adding to result array
2025-10-29 06:20:49 -07:00
Andrew Kelley
923a7bdd7e std.Io.net: fix parsing IPv4-mapped IPv6 addresses 2025-10-29 06:20:49 -07:00
Andrew Kelley
3b34622368 std.Io: add unix domain sockets API
note that "reuseaddr" does nothing for these
2025-10-29 06:20:49 -07:00
Andrew Kelley
ebcc6f166c std.Io: bring back Timestamp but also keep Clock.Timestamp
this feels better
2025-10-29 06:20:49 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley
b428612a20 WIP: hack away at std.Io return flight 2025-10-29 06:20:48 -07:00
Andrew Kelley
774df26835 WIP: hack at std.Io on a plane 2025-10-29 06:20:48 -07:00
Andrew Kelley
00f26cb0a4 WIP land the std.Io interface
fix std lib compilation errors caused by introducing std.Io
2025-10-29 06:20:48 -07:00
Andrew Kelley
85a6fea3be std.Io.net.HostName: implement DNS name expansion 2025-10-29 06:20:48 -07:00
Andrew Kelley
f1a590c876 std.Io.net.HostName: implement DNS reply parsing 2025-10-29 06:20:48 -07:00
Andrew Kelley
a6347a68a9 std.Io.net: implement receiving connectionless messages 2025-10-29 06:20:48 -07:00
Andrew Kelley
95dee2af9c std.Io: implement netSend 2025-10-29 06:20:48 -07:00
Andrew Kelley
cde5a51d0c std.Io.net: make netSend support multiple messages
this lowers to sendmmsg on linux, and means Io.Group is no longer
needed, resulting in a more efficient implementation.
2025-10-29 06:20:48 -07:00
Andrew Kelley
b22400271f std.Io.net.HostName: finish implementing DNS lookup 2025-10-29 06:20:48 -07:00
Andrew Kelley
8e1da66ba1 std.Io: implement Group API 2025-10-29 06:20:48 -07:00
Andrew Kelley
60c4bdb14c Io.net: implement more networking
the next task is now implementing Io.Group
2025-10-29 06:20:48 -07:00
Andrew Kelley
8771a9f082 std.Io.net: progress towards DNS resolution 2025-10-29 06:20:48 -07:00
Andrew Kelley
885b3f8342 Io.net: finish implementing IPv6 parsing 2025-10-29 06:20:48 -07:00
Andrew Kelley
e7c9df9fb0 Io.net: use resolve for IPv6
/etc/resolv.conf might have IPv6 addresses with scope in it, so this is
needed.
2025-10-29 06:20:48 -07:00
Andrew Kelley
d776a6bbbe Io.net: rework IPv6 parsing and printing
extract pure functional logic into pure functions and then layer the
scope crap on top properly

the formatting code incorrectly didn't do the reverse operation
(if_indextoname). fix that with some TODO panics
2025-10-29 06:20:48 -07:00
Andrew Kelley
0e9280ef1a std.Io: extract Dir to separate file 2025-10-29 06:20:48 -07:00
Andrew Kelley
fc1e3d5bc9 Io.net: partial implementation of dns lookup 2025-10-29 06:20:48 -07:00