Implement caller-owned LiteNetLib punch and direct-connect coordination in the SDK #12

Open
opened 2026-07-15 10:04:22 +02:00 by Kyuubi · 2 comments
Owner

Parent: #1
Depends on: #9, #11

Outcome

Give each game a deterministic traversal state machine that reuses its gameplay NetManager and establishes an authenticated direct connection.

Scope

  • Wrap a caller-owned LiteNetLib manager; never open a hidden second gameplay UDP socket.
  • Expose explicit Poll/Tick integration with normal synchronized event dispatch rather than invisible worker callbacks.
  • Coordinate host presence refresh, join issuance, client presence, NAT-success callbacks, endpoint selection, Connect, and connection-ticket presentation/validation.
  • Report success only after the LiteNetLib peer connects and the host accepts the ticket.
  • Support cancellation, bounded jittered retries, lifecycle disposal, late callbacks, duplicate callbacks, and manager shutdown.
  • Keep API and state machine Godot-independent and safe for the game main thread.

Acceptance criteria

  • Host and client complete introduction and an authenticated direct connection through caller-owned managers.
  • NAT introduction alone is never reported as connection success.
  • Timeout, cancellation, disposal, rejection, duplicate callbacks, and late events each produce one terminal transition.
  • No SDK operation invokes the manager concurrently from unsafe threads.
  • Connection tickets cannot be reused for a second peer connection.
  • Integration examples show exactly where games poll the coordinator.
  • Resource and event subscriptions are released after every terminal path.
Parent: #1 Depends on: #9, #11 ## Outcome Give each game a deterministic traversal state machine that reuses its gameplay `NetManager` and establishes an authenticated direct connection. ## Scope - Wrap a caller-owned LiteNetLib manager; never open a hidden second gameplay UDP socket. - Expose explicit `Poll`/`Tick` integration with normal synchronized event dispatch rather than invisible worker callbacks. - Coordinate host presence refresh, join issuance, client presence, NAT-success callbacks, endpoint selection, `Connect`, and connection-ticket presentation/validation. - Report success only after the LiteNetLib peer connects and the host accepts the ticket. - Support cancellation, bounded jittered retries, lifecycle disposal, late callbacks, duplicate callbacks, and manager shutdown. - Keep API and state machine Godot-independent and safe for the game main thread. ## Acceptance criteria - Host and client complete introduction and an authenticated direct connection through caller-owned managers. - NAT introduction alone is never reported as connection success. - Timeout, cancellation, disposal, rejection, duplicate callbacks, and late events each produce one terminal transition. - No SDK operation invokes the manager concurrently from unsafe threads. - Connection tickets cannot be reused for a second peer connection. - Integration examples show exactly where games poll the coordinator. - Resource and event subscriptions are released after every terminal path.
Kyuubi self-assigned this 2026-07-16 07:37:57 +02:00
Author
Owner

Starting implementation on stacked branch codex/issue-12-client-coordinator, based on verified mediator commit 6d076c2. Scope: caller-owned LiteNetLib manager only, explicit main-thread polling, host presence/invitation and client join state machines, ticket presentation/one-time validation, bounded retries/cancellation/late-event handling, and end-to-end direct-connect tests.

Starting implementation on stacked branch `codex/issue-12-client-coordinator`, based on verified mediator commit `6d076c2`. Scope: caller-owned LiteNetLib manager only, explicit main-thread polling, host presence/invitation and client join state machines, ticket presentation/one-time validation, bounded retries/cancellation/late-event handling, and end-to-end direct-connect tests.
Author
Owner

Implemented and pushed on codex/issue-12-client-coordinator at b4b6072.

Highlights:

  • caller-owned, explicitly polled LiteNetLib client/host coordinators with a bound routing listener and no hidden socket
  • authenticated NAT introductions and one-time direct-connection tickets; gameplay handlers cannot bypass validation
  • cancellation tombstones revoke host-local authorization, including the post-introduction race
  • bounded host work and latest-only refresh snapshots; retry, timeout, disposal, manager-stop, duplicate, and late-callback handling
  • SDK polling examples, updated OpenAPI/ADR/public API snapshots

Verification:

  • Debug build: pass
  • Debug tests: 167 passed, 0 failed, 0 skipped
  • Release build: pass
  • Release tests: 167 passed, 0 failed, 0 skipped
  • Client and Contracts NuGet packages produced and inspected
  • branch audit findings fixed and covered by regression tests

Left open because this stacked branch has not been merged into main.

Implemented and pushed on `codex/issue-12-client-coordinator` at `b4b6072`. Highlights: - caller-owned, explicitly polled LiteNetLib client/host coordinators with a bound routing listener and no hidden socket - authenticated NAT introductions and one-time direct-connection tickets; gameplay handlers cannot bypass validation - cancellation tombstones revoke host-local authorization, including the post-introduction race - bounded host work and latest-only refresh snapshots; retry, timeout, disposal, manager-stop, duplicate, and late-callback handling - SDK polling examples, updated OpenAPI/ADR/public API snapshots Verification: - Debug build: pass - Debug tests: 167 passed, 0 failed, 0 skipped - Release build: pass - Release tests: 167 passed, 0 failed, 0 skipped - Client and Contracts NuGet packages produced and inspected - branch audit findings fixed and covered by regression tests Left open because this stacked branch has not been merged into `main`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HeiKyu/Rendezvous#12