ENet transport with a handshake covering protocol version, player name and join rejection, plus clean disconnects and timeouts.
Acceptance
A version mismatch gives a clear refusal.
Tests run a real server and client over loopback.
Malformed handshakes never crash the server.
**Depends on:** F6, M1
ENet transport with a handshake covering protocol version, player name and join rejection, plus clean disconnects and timeouts.
**Acceptance**
- A version mismatch gives a clear refusal.
- Tests run a real server and client over loopback.
- Malformed handshakes never crash the server.
claude
added this to the v0.5 Multiplayer milestone 2026-11-09 05:28:10 +00:00
NetProtocol: HELLO / WELCOME / REJECT layouts, protocol version 1, name cleaning, the reasons a connection ends, and a sentence for the player about each.
NetServer: listens with ENet (through ENetConnection, not the high-level multiplayer API), takes each guest through the handshake and reports joined, left and refused. It refuses a different protocol version, a full server, a malformed HELLO and a silent guest, each with its own reason. Handles are never reused, and duplicate names get a number.
NetClient: connects, sends HELLO, and ends up joined or closed with a reason. leave() says goodbye so the server knows at once. A client that vanishes is dropped by ENet's timeout.
The design is in docs/ARCHITECTURE.md under "Transport and handshake".
Acceptance
Version mismatch: the client closes with REASON_VERSION and a message that says which side is behind, for example "This server runs an older version of Tidewall (protocol 1; this game speaks 2). It needs updating before you can join."
Real server and client over loopback UDP: 13 tests in test/net/test_net_handshake.gd (join, version refusal, full server, duplicate names, clean leave, vanished client timing out, silent guest, no server, server shutdown, kick, port already in use).
Malformed handshakes: bare ENet peers send empty, truncated, wrong-magic, 60 kB, invalid-UTF-8, wrong-type and wrong-channel packets, then 72 random packets from guests and 40 junk packets from a joined player. Each bad guest is refused and disconnected, the joined player is unaffected, no engine error is raised, and the server still accepts a good client afterwards. test_net_protocol.gd also feeds 4,000 random buffers to the decoders.
Tested:make check passes: 358 tests, self-check and smoke. Loopback only; nothing was tested across a real network, with packet loss, or over IPv6.
Not in this issue
The headless server doesn't listen yet, and joined players aren't put into the match. N2 does that first, feeding commands through ServerLoop.submit().
No rate limiting or per-address connection limits. That belongs to N9.
Done in 98a1a05.
**What changed**
- `NetProtocol`: HELLO / WELCOME / REJECT layouts, protocol version 1, name cleaning, the reasons a connection ends, and a sentence for the player about each.
- `NetServer`: listens with ENet (through `ENetConnection`, not the high-level multiplayer API), takes each guest through the handshake and reports `joined`, `left` and `refused`. It refuses a different protocol version, a full server, a malformed HELLO and a silent guest, each with its own reason. Handles are never reused, and duplicate names get a number.
- `NetClient`: connects, sends HELLO, and ends up joined or closed with a reason. `leave()` says goodbye so the server knows at once. A client that vanishes is dropped by ENet's timeout.
- The design is in `docs/ARCHITECTURE.md` under "Transport and handshake".
**Acceptance**
- Version mismatch: the client closes with `REASON_VERSION` and a message that says which side is behind, for example "This server runs an older version of Tidewall (protocol 1; this game speaks 2). It needs updating before you can join."
- Real server and client over loopback UDP: 13 tests in `test/net/test_net_handshake.gd` (join, version refusal, full server, duplicate names, clean leave, vanished client timing out, silent guest, no server, server shutdown, kick, port already in use).
- Malformed handshakes: bare ENet peers send empty, truncated, wrong-magic, 60 kB, invalid-UTF-8, wrong-type and wrong-channel packets, then 72 random packets from guests and 40 junk packets from a joined player. Each bad guest is refused and disconnected, the joined player is unaffected, no engine error is raised, and the server still accepts a good client afterwards. `test_net_protocol.gd` also feeds 4,000 random buffers to the decoders.
**Tested:** `make check` passes: 358 tests, self-check and smoke. Loopback only; nothing was tested across a real network, with packet loss, or over IPv6.
**Not in this issue**
- The headless server doesn't listen yet, and joined players aren't put into the match. N2 does that first, feeding commands through `ServerLoop.submit()`.
- No rate limiting or per-address connection limits. That belongs to N9.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Depends on: F6, M1
ENet transport with a handshake covering protocol version, player name and join rejection, plus clean disconnects and timeouts.
Acceptance
Done in
98a1a05.What changed
NetProtocol: HELLO / WELCOME / REJECT layouts, protocol version 1, name cleaning, the reasons a connection ends, and a sentence for the player about each.NetServer: listens with ENet (throughENetConnection, not the high-level multiplayer API), takes each guest through the handshake and reportsjoined,leftandrefused. It refuses a different protocol version, a full server, a malformed HELLO and a silent guest, each with its own reason. Handles are never reused, and duplicate names get a number.NetClient: connects, sends HELLO, and ends up joined or closed with a reason.leave()says goodbye so the server knows at once. A client that vanishes is dropped by ENet's timeout.docs/ARCHITECTURE.mdunder "Transport and handshake".Acceptance
REASON_VERSIONand a message that says which side is behind, for example "This server runs an older version of Tidewall (protocol 1; this game speaks 2). It needs updating before you can join."test/net/test_net_handshake.gd(join, version refusal, full server, duplicate names, clean leave, vanished client timing out, silent guest, no server, server shutdown, kick, port already in use).test_net_protocol.gdalso feeds 4,000 random buffers to the decoders.Tested:
make checkpasses: 358 tests, self-check and smoke. Loopback only; nothing was tested across a real network, with packet loss, or over IPv6.Not in this issue
ServerLoop.submit().