Skip to content

Co-op: handle a dropped peer on the session tick, not the transport thread - #51

Merged
codingncaffeine merged 1 commit into
codingncaffeine:mainfrom
qwerin:fix/mp-peer-gone-thread
Nov 9, 2026
Merged

codingncaffeine merged 1 commit into
codingncaffeine:mainfrom
qwerin:fix/mp-peer-gone-thread

Conversation

@qwerin

@qwerin qwerin commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Split out of #36 (one fix per PR, as suggested there).

Co-op: a dropped peer no longer crashes the host. The LAN keepalive (and EOS callbacks) raise PeerDisconnected on their own thread; OnPlayerLeft then removed the remote avatar from _actors while the render loop enumerated it (Collection was modified). MpSession now queues leaves and drains them at the start of Tick, on the thread that ticks the session. NetSelfTest ticks the host after its two disconnects (in-region and staging).

Checks: rebased on main (bef1f38); dotnet build SiegeFX.sln -c Release -warnaserror clean; dotnet test passes (new MpDisconnectTests); SiegeFX --selftest-net: ALL PASS. Play-tested: a client timing out no longer takes the host down.

🤖 Generated with Claude Code

…hread

The LAN keepalive (and EOS callbacks) raise PeerDisconnected from a pool
thread. MpSession ran OnPeerGone there, so OnPlayerLeft removed the remote
avatar from RenderHost._actors while the render loop enumerated it: the host
crashed with "Collection was modified" when a client timed out. The session
now queues the leave and drains it at the start of Tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codingncaffeine
codingncaffeine merged commit b28875f into codingncaffeine:main Nov 9, 2026
9 checks passed
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.

2 participants