Repository navigation
Tell the relay which machine this is - #18
Conversation
The machines on the shared network client all send the same User-Agent, so the relay's statistics cannot tell a C64 from an Amiga. NET_PLATFORM in plat_config.h adds &pf=<id> to the connection URL. It changes nothing in a game, and both relays accept it. create and join share one path buffer, now large enough for the longest URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Platform identifiers and parameter contract docs/net-protocol.md, c/platform/{amiga,atari,atarist,c64,cpc,pc,web,zx}/plat_config.h |
Platform configurations define NET_PLATFORM identifiers. The protocol documentation describes the optional pf parameter, accepted identifiers, and handling of unknown identifiers. |
Platform parameter in room requests c/common/netdev_soft.c |
Room creation and join request paths append PF_ARG. The macro expands to the configured platform parameter or an empty string when NET_PLATFORM is undefined. Both paths use a shared 52-byte buffer. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Merge Risk: 
Minimal · up to 1b95e
-
The platform identifiers and optional relay parameter are ready to merge, subject to normal CI validation.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "Tell the relay which machine this is" describes the main change. The PR adds a
pf=<id>platform parameter to create and join URLs whenNET_PLATFORMis defined, so the relay can tell which machine connects. The title is specific and short. It does not name the parameter or the files, which is acceptable for a title.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The relay's statistics can't tell most machines apart: every build on the shared network client (
common/ws.c) sendsUser-Agent: BomberNet, so C64, PC, Amiga and the rest count as one "retro machine" group. This makes each build name itself on the connection URL.What changes
NET_PLATFORMinplat_config.hadds&pf=<id>to the create and join URLs. The ids are the port ids in the catalog:c64,amiga,atari-xl,atari-st,amstrad-cpc,pc-dos,zx-spectrum-48k,element-zx-128k,browser.NET_PLATFORM(host, sim6502) sends what it sends today.netdev_card.c, and the MZPico firmware already names itself.net_createandnet_joinnow share onepathbuffer of 52 bytes instead of having 40 each. The longest URL is/net?game=16974&code=ABCD&bin=1&pf=element-zx-128k, 50 characters plus the terminator.docs/net-protocol.mddocuments the parameter.Compatibility
There is no protocol change and
BUILD_IDstays the same, so machines with and without this play together. The production relay already readspfand treats an unknown id as if there were none.relay/relay.pyonly looks atbin.Testing
Tested locally with
softnet_test(the C network client on a PC) against the production relay code running underwrangler dev:NET_PLATFORM="element-zx-128k"withNET_BINARY_INPUT, built with ASan and UBSan: a 60-frame match passed, and the relay counted both seats aselement-zx-128k.NET_PLATFORM: a 60-frame match passed, and the relay counted both seats asretro, as it does today.Not tested locally: the retro toolchains aren't installed here, so the machine builds,
check_sizes.pyand the Spectrum matches rely on CI.relay/relay.pywasn't run locally either.Worth checking in review
check_sizes.pyshould confirm that still fits.ZX128always reportselement-zx-128k, including the test-onlyZX128_NET=spectranetbuild.The new ids reach players with the next release; nothing else needs to ship with it.
🤖 Generated with Claude Code
Summary by CodeRabbit