Commit Graph

48 Commits

Author SHA1 Message Date
Lukas Lalinsky e8a2e6578a Add std.Io.net.Stream.shutdown 2025-12-29 02:20:37 +01:00
Andrew Kelley 5b436d2c51 build_runner compiling again 2025-12-23 22:15:08 -08:00
Andrew Kelley 7f5bb118d4 std.Io: make all the close functions batched 2025-12-23 22:15:08 -08:00
Andrew Kelley 72b76077ab std: fix some surface level compilation errors
And boldly remove preadv, pwritev, readv, writev, pread, pwrite from
std.posix.
2025-12-23 22:15:07 -08:00
Loris Cro 58e3c2cefd make Io.net.sendMany compile 2025-12-05 11:50:04 +01:00
Nikolay Govorov a0289d0cce std.posix.accept: handle non-listening socket EINVAL 2025-11-29 19:57:59 +01:00
David Rubin 71988d6719 Io.net: set receive{,Timeout} message to init
If we use `undefined`, then `netReceive` can `@intCast` the
control slice len to msghdr controllen, which is sometimes `u32`,
even on 64-bit platforms.

`init` just avoids this entirely by setting `control` to an empty
slice rather than undefined.
2025-11-06 17:44:28 -08:00
David Rubin 654a5b20d7 Io: fix compile error in receive and receiveTimeout
Correctly uses the `netReceive` API. If an error was
returned, we propagate that error, otherwise assert
we only received one message.
2025-11-06 17:42:19 -08:00
Andrew Kelley c4dc7d7c3d std.Io.Threaded: implement Unix sockets for Windows 2025-10-29 06:20:52 -07:00
Andrew Kelley ecdc00466c std.Io.net: make it easier to use netReceiveMany correctly 2025-10-29 06:20:51 -07:00
Andrew Kelley a5c309a692 std.Io.net.Socket.send: fix compilation errors 2025-10-29 06:20:51 -07:00
Andrew Kelley 83e4ff6f4c std.Io: add dirClose 2025-10-29 06:20:50 -07:00
Andrew Kelley e87ceb76c2 std.Io.net.Server: refine AcceptError set 2025-10-29 06:20:50 -07:00
Andrew Kelley cf6fa219fd std.Io.Threaded: fix netWrite cancellation
Move std.posix logic over rather than calling into it.
2025-10-29 06:20:50 -07:00
Andrew Kelley f7bbcb4a4b fix miscellaneous compilation failures 2025-10-29 06:20:50 -07:00
Andrew Kelley 22334f5730 std: make IPv6 address parsing system-independent
before, the max length of the host name depended on the target.
2025-10-29 06:20:50 -07:00
Andrew Kelley 031044b399 std: fix macos compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley 426a377c7b std.Io.net.Stream: add "const" variant to "close"
useful for resource management
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 0732ff2263 std.Io.Threaded: implement connecting to unix sockets 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 923a7bdd7e std.Io.net: fix parsing IPv4-mapped IPv6 addresses 2025-10-29 06:20:49 -07:00
Andrew Kelley e0e463bcf7 std.Io.net.Stream.Reader: fix not using buffer 2025-10-29 06:20:49 -07:00
Andrew Kelley be1ae430a1 std.Io.Threaded.netReadPosix: support cancelation 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 47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley 066864a0bf std.zig.system: upgrade to std.Io.Reader 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 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 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 5782158628 std.net: fix parsing IPv6 addr "::" 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
Andrew Kelley b4e5e9d48f Io.net: implement sortLookupResults 2025-10-29 06:20:48 -07:00
Andrew Kelley e7729a7b89 std: start moving fs.File to Io 2025-10-29 06:20:48 -07:00
Andrew Kelley bd3c65f752 std.Io.net: partially implement HostName.lookup 2025-10-29 06:20:48 -07:00
Andrew Kelley 668f905243 add some networking 2025-10-29 06:20:48 -07:00