| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A server that accepted and then said nothing held the caller for ever:
Fsys read its socket with no limit, the version in init included, while
pardes's own client gives a call 2 s and a write that runs a command
30 s. Fsys gains one field, `timeout` (an Io.Timeout), which init sets
to `default_timeout`, 30 s, before it speaks; each call's answer is read
by operateTimeout until that long after the call is sent, and past it the
call is error.Timeout (the answer may come yet, under a tag the next call
does not expect, so the connection is to be closed). `.none` waits for
ever: verbs' follow sets it, since following an event file waits as long
as the events take; read, ls, ask and the rest keep the deadline and say
"no answer in 30000 ms; fs follow waits for ever".
Test: a held read nobody feeds, on a 100 ms timeout, is error.Timeout
after 90-5000 ms (poll counts whole milliseconds). cloud9's test 108 of
108; serve's "two clients at once" and "repeated connect/disconnect"
failed once each at load 13 and passed in the four runs after, as on the
base: they do not touch Fsys.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
|
|
|
Every program that serves a cloud9 tree should be drivable through it from
its own binary and from agents, and pardes, 9ns and pardes's Python tests
each carried a blocking client of their own. Fsys is the one the library
lacked, plan9port's lib9pclient over `Client`: dial a name posted in the
registry (a subdirectory entry such as pardes/main included), unix!PATH or
tcp!HOST!PORT; open, create, remove, stat, read, write and clunk by path and
fid; readFile, writeFile and ask (write, then read the answer on the same
open from the start, as Plan 9 reads /net/cs) streaming into a
std.Io.Writer, flushed per answer, so an event file whose reads park streams as it comes. A refusal is
error.Refused and said() holds the server's words, which a mount would have
turned into an errno.
Taken from pardes's Client (src/9p_io.zig): the walk sent ahead of the
request that uses its fid, the clunk not waited for, and the answers of
both checked or dropped on the way to the request's, so an open, a stat or
a remove is one round trip; error words kept as the server said them. Not
taken: its kept-connection table, flights of read-ahead, the stat-length
end of file and its pardes-only dials. From 9ns: the chunked read/write
loops and the iounit. Buffers inline (2 x 64 KiB), no allocator, std.Io
streams only, so it builds without libc.
TestTree.zig is a small tree on serve.Runner for these tests and the next
change's. Tests over a Unix socket and TCP against cloud9's own engine:
whole files longer than a message, stats, walks longer than 16 names, a
missing first name and a walk short of its names refused in the server's
words, a refused write whose words reach the caller, a short read that is
not the end, ask, a held read streaming three chunks flushed one at a time,
a server that hangs up mid-read, create and remove, a directory decoded as
entries, dial by posted name and a name that climbs out of the registry.
|