v0.5.0
The first tagged release. Earlier versions here describe the tree as it was
developed, not as anything anyone could name and fetch.
Fixed
- The build passed
ar rvD, whoseDflag is GNU binutils only, so building
any archive failed on macOS, and with the archiver's stderr discarded it
failed with no message. Fixed upstream in modular-make 1.8.5, which probes
for the flag, addscso the archiver is silent unless something is wrong,
and no longer discards its stderr. The vendoredGNUmakefilemoves from
1.8.0 to 1.8.5. nc_cryptoandkeystorecalledgetrandom(2)unconditionally, so
neither compiled anywhere but Linux. Both now select a backend at compile
time:arc4random_bufon macOS and the BSDs,getrandom(2)on Linux with
a retry onEINTR, and/dev/urandomotherwise, which also covers a Linux
kernel too old for the syscall. macOS is now built and tested in CI, which
is how this was found.nc_random_id()fell back to an unseededrand()whenever it could not
read/dev/urandom, so every process produced the identical sequence of
connection ids. That was the normal path on Windows, where the file does not
exist, and reachable anywhere/devis missing. It now asks the platform
for real entropy, and the last-resort path mixes the clock with a stack
address instead of callingrand()at all.- Three tests read from a loopback socket without ever waiting and treated an
empty queue as no traffic. Linux queues a loopback datagram inside
sendto(), so the read always found it; macOS delivers through a separate
context, so the reads came back empty and the tests gave up early. That
failed the macOS CI job innc_udp_testandtest_gnet, and left
test_microchanpassing on a few microseconds of luck. The socket tests now
wait for the datagram, and the protocol tests no longer use a socket at all.
Added
-
A version, and a way to get one. The project is SemVer from 0.5.0 on, the
version is insrc/netchan.hasNETCHAN_VERSION_MAJOR,_MINOR,_PATCH,
_STRING, and a comparableNETCHAN_VERSIONinteger, and releases are git
tags of the formv0.5.0. A release workflow refuses to publish a tag that
disagrees with the header. -
tools/vendor.sh, which copies a release into another project's tree. It
takes the layers you name plus the ones they depend on, from the source
snapshot GitHub serves for the tag, and records what it took. It runs
standalone or piped:curl -fsSL https://raw.githubusercontent.com/OrangeTide/netchan/v0.5.0/tools/vendor.sh \ | sh -s -- --version v0.5.0 --layer auth -
tests/netchan_test: the channel accessors, including a receiver
identifying channels by the content type carried in the peer's OPEN, and
the truncation seam where the 64-byte field meets the 63-byte wire cap. -
Windows support for the library. The core takes its monotonic clock from
GetTickCount64and its connection ids fromrand_s;nc_cryptoand
keystoretake entropy fromBCryptGenRandom;nc_udp.hincludes winsock2
instead of<sys/socket.h>.crypto/andauth/need-lbcrypt, which
the build now exports to their dependents. The core needs nothing on the
link line, which is why it usesrand_srather than the same call: a
vendoredsrc/still builds with nothing but a compiler.The examples are unchanged and remain POSIX. They own sockets, an event
loop, and a terminal. -
A CI job that cross-compiles for Windows with mingw-w64 and runs every
socket-free test binary under wine, so the entropy and clock backends are
executed rather than merely linked. Without it this would rot unnoticed,
which is exactly what happened to macOS. -
netchan_chan_content_type(), the accessor for the string given to
netchan_chan_open()or carried in the peer's OPEN. It tells apart channels
that share a netchan type, such as two reliable streams named "control" and
"events". Never NULL; a channel opened without one reads back as "". -
microchan/tests/mc_memlink, an in-memory datagram link for tests:
delivery is a function call, and loss, duplication, and reordering happen on
a fixed count.test_microchangains a check that the Go-Back-N window
holds its line through reordering and duplication, which loopback UDP could
not produce on demand. -
microchan/tests/test_mc_udp, covering the host UDP transport on its own:
the ephemeral bind, the address packing, the return convention of a
non-blocking recv, and that the address a datagram arrives with is usable as
a destination.
Changed
-
test_microchanandtest_gnetrun overmc_memlinkinstead of loopback
UDP. Neither the core nor the game net layer touches a socket, so the
socket was testing nothing about them while making both tests
platform-dependent. They are now deterministic everywhere, andtest_gnet
went from 1.2s to 0.3s. -
microchan/, a second library: the same idea with one allocation per
connection and none after it, every buffer inside it fixed at compile time,
Go-Back-N over an 8-message window instead of selective ack, and a core that
fits in a 16-bit large-model DOS binary.
Transports are IPX for MS-DOS and UDP for a host. It brings its own tests,
the four-playerthorgame the variant exists for, and an Open Watcom
makefilefor the DOS target.It is a separate library, not a build option. Its API was renamed on import
fromnc_*/NC_*/struct netchantomc_*/MC_*/struct microchan,
because the two trees otherwise both definestruct nc_addrwith different
layouts and both ship annc_addr.h,nc_udp.c/h, andnetchan.c/h. Same
names, different meanings, one repository. Nothing links both.
Vendoring
curl -fsSL https://raw.githubusercontent.com/OrangeTide/netchan/v0.5.0/tools/vendor.sh | sh -s -- --version v0.5.0The source snapshot below is what that fetches. See
VENDORING.md.