Skip to content

Add docs/ARCHITECTURE.md: system overview, source map, threading model#3791

Open
mcfnord wants to merge 3 commits into
jamulussoftware:mainfrom
mcfnord:add-architecture-doc
Open

Add docs/ARCHITECTURE.md: system overview, source map, threading model#3791
mcfnord wants to merge 3 commits into
jamulussoftware:mainfrom
mcfnord:add-architecture-doc

Conversation

@mcfnord

@mcfnord mcfnord commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Split out of #3789 per review — one new file per PR.

A single page answering the questions every new contributor (human or agent) otherwise reconstructs from scratch: how audio flows client → server → client, which class lives in which file, which threads exist and which of them are real-time, how a UDP "connection" works without a handshake, how directory servers and hole punching fit in, and where common kinds of changes go. It states two invariants: never block the real-time path, and treat all network input as untrusted.

Everything in it is verified against current main (socket.cpp ProcessPacket(), CHighPrecisionTimer/OnTimer, CChannel, CServerListManager).

Two things worth discussing here, per the comments in #3789:

  • AGENTS.md stays extremely short and just links here; this file is the long-form home. If any part of this belongs in AGENTS.md instead (or vice versa), happy to move it.
  • Agents can enumerate src/ themselves, so the source map is aimed at humans — it carries the class→file responsibilities that enumeration doesn't reveal. Can trim if you prefer.

Docs only; no code changes.

CHANGELOG: SKIP

🤖 Generated with Claude Code

One place that answers: how audio flows, which class lives where, which
threads exist, how a UDP "connection" works, and the two invariants that
protect live performances (never block the real-time path; all network
input is untrusted).

Co-Authored-By: Claude Fable 5 <[email protected]>

@ann0see ann0see left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we'll need to make this more detailed. Also explain classes, ...

@mcfnord

mcfnord commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Added a "Key classes and how they connect" section — the ownership tree (CServervecChannels[]SockBuf/Protocol, plus ConnLessProtocol, and the client side) with a short responsibility note per class, member names as declared in the headers. Also upgraded to the full AGPL header per your comment on #3790.

Is that the level of detail you had in mind, or do you want it to go deeper (e.g. per-class method walkthroughs)? My instinct is to keep it at "what state lives where and who calls whom" and let the code carry the rest, so the doc doesn't rot.

@pljones

pljones commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Whilst keeping this as the "this is the current architecture" guide, I'd like somewhere that directs people on what the "target architecture" is: the clear separation of concerns as raised in #3801. I guess that Issue can have that document as a deliverable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants