docs/JAMULUS_PROTOCOL.md: message reference, directory flows, small fixes - #3794
docs/JAMULUS_PROTOCOL.md: message reference, directory flows, small fixes#3794mcfnord wants to merge 1 commit into
Conversation
softins
left a comment
There was a problem hiding this comment.
This looks good. Just a few comments and suggested changes.
|
Please squash the commits here. |
5d057a5 to
2386d21
Compare
be4b4e7 to
29ea574
Compare
|
🤖 AI: Squashed to a single commit. Ready for re-review. |
| This is defined in `CServer::OnNewConnection()` | ||
|
|
||
| The client on a new connection will: | ||
| The Client on a new connection will: |
There was a problem hiding this comment.
"On new connection" - i.e. regardless of the REQ_xxx messages coming from the Server? Needs to be made clear either way.
Fundamentally what - for the Client - is a "new connection"? It's clearly stated for the Server. (Is it "when I start sending audio" or "when I get a Channel ID assigned" or something else...?)
| This is defined in `CClient::OnNewConnection()` | ||
|
|
||
| At the end of the session, the client calls the `CLM_DISCONNECTION (1010, 0xf203)` message, until the server stops streaming audio to it. | ||
| At the end of the session, the Client repeatedly sends a `CLM_DISCONNECTION (1010, 0xf203)` message, until the Server stops streaming audio to it. |
There was a problem hiding this comment.
So
a) this is CLM so no ACKN but
b) it's up to the Server to stop sending or the Client is stuck?
|
|
||
| - A Server registers with `CLM_REGISTER_SERVER_EX (1017)` (older versions: `CLM_REGISTER_SERVER (1004)`) and receives `CLM_REGISTER_SERVER_RESP (1016)` carrying the result (registered, list full, version too old, requirements not fulfilled). If no response arrives, registration is retried every 500 ms, up to 5 times. | ||
| - Registration is refreshed every 15 minutes; the Directory drops a Server it has not heard from for 33 minutes. `CLM_UNREGISTER_SERVER (1005)` removes the entry immediately at shutdown or when changing Directory through the Server UI. | ||
| - A Client requests the list with `CLM_REQ_SERVER_LIST (1007)`. The Directory answers with both `CLM_RED_SERVER_LIST (1018)` (a shorter form that reduces UDP fragmentation) and `CLM_SERVER_LIST (1006)` (the full information). The Client then pings each listed Server with `CLM_PING_MS_WITHNUMCLIENTS (1002)` to display latency and occupancy. |
There was a problem hiding this comment.
| - A Client requests the list with `CLM_REQ_SERVER_LIST (1007)`. The Directory answers with both `CLM_RED_SERVER_LIST (1018)` (a shorter form that reduces UDP fragmentation) and `CLM_SERVER_LIST (1006)` (the full information). The Client then pings each listed Server with `CLM_PING_MS_WITHNUMCLIENTS (1002)` to display latency and occupancy. | |
| - A Client requests the server list with `CLM_REQ_SERVER_LIST (1007)`. The Directory answers with both `CLM_RED_SERVER_LIST (1018)` (a shorter form that reduces UDP fragmentation) and `CLM_SERVER_LIST (1006)` (the full information). The Client then pings each listed Server with `CLM_PING_MS_WITHNUMCLIENTS (1002)` to display latency and occupancy. |
(my pedantry...)
| - A Server registers with `CLM_REGISTER_SERVER_EX (1017)` (older versions: `CLM_REGISTER_SERVER (1004)`) and receives `CLM_REGISTER_SERVER_RESP (1016)` carrying the result (registered, list full, version too old, requirements not fulfilled). If no response arrives, registration is retried every 500 ms, up to 5 times. | ||
| - Registration is refreshed every 15 minutes; the Directory drops a Server it has not heard from for 33 minutes. `CLM_UNREGISTER_SERVER (1005)` removes the entry immediately at shutdown or when changing Directory through the Server UI. | ||
| - A Client requests the list with `CLM_REQ_SERVER_LIST (1007)`. The Directory answers with both `CLM_RED_SERVER_LIST (1018)` (a shorter form that reduces UDP fragmentation) and `CLM_SERVER_LIST (1006)` (the full information). The Client then pings each listed Server with `CLM_PING_MS_WITHNUMCLIENTS (1002)` to display latency and occupancy. | ||
| - NAT hole punching: when it answers a list request, the Directory also sends every registered Server a `CLM_SEND_EMPTY_MESSAGE (1008)` carrying the Client's public address; each Server responds by sending `CLM_EMPTY_MESSAGE (1009)` to that address, in order to open its own NAT/firewall for the Client's subsequent packets. It doesn't matter whether the Client receives this message, as it will ignore it. The Directory and its registered Servers also ping each other about once a minute to keep their NAT mappings alive. |
There was a problem hiding this comment.
| - NAT hole punching: when it answers a list request, the Directory also sends every registered Server a `CLM_SEND_EMPTY_MESSAGE (1008)` carrying the Client's public address; each Server responds by sending `CLM_EMPTY_MESSAGE (1009)` to that address, in order to open its own NAT/firewall for the Client's subsequent packets. It doesn't matter whether the Client receives this message, as it will ignore it. The Directory and its registered Servers also ping each other about once a minute to keep their NAT mappings alive. | |
| - NAT hole punching: when it answers a server list request, the Directory also sends every registered Server a `CLM_SEND_EMPTY_MESSAGE (1008)` carrying the Client's public address; each Server responds by sending `CLM_EMPTY_MESSAGE (1009)` to that address, in order to open its own NAT/firewall for the Client's subsequent packets. It doesn't matter whether the Client receives this message, as it will ignore it. The Directory and its registered Servers also ping each other about once a minute to keep their NAT mappings alive. |
One file. Fills the main gaps in the protocol doc, verified against
src/protocol.cpp/src/socket.cpp/src/serverlist.cppon current main:CSocket::ProcessPacket()), the CRC parameters, and how acknowledge/retransmit actually works — previously the doc said only "must be acknowledged".protocol.h.CLM_SEND_EMPTY_MESSAGE/CLM_EMPTY_MESSAGENAT hole-punch flow — previously undocumented here despite being a third of the connectionless messages.protocol.h(REQ_CHANNEL_INFOS,CHANNEL_INFOS,REQ_CONN_CLIENTS_LIST).CHANGELOG: SKIP
🤖 Generated with Claude Code