Server: Allow game to continue without host in FreezeManager#866
Merged
Server: Allow game to continue without host in FreezeManager#866
Conversation
When the host disconnects, the FreezeManager previously returned early, leaving the server frozen indefinitely. Now when the host is absent: - If players are still connected, the server unfreezes so the game can continue - If no players are connected, the freeze state is left unchanged (the server loop already won't advance the game timer without players) - When the host reconnects, normal host-driven freeze/unfreeze behavior resumes
There was a problem hiding this comment.
Pull request overview
Fixes a server “stuck frozen” condition when the host disconnects by making FreezeManager.Tick() explicitly handle the host-absent case, allowing remaining active players to continue.
Changes:
- Update
FreezeManager.Tick()to follow host freeze state when present, and to unfreeze when the host is absent but players are still playing. - Add a lightweight
ConnectionBasetest double to simplify server/player setup in unit tests. - Add 6 unit tests covering host-present, host-absent, and host-reconnect scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Source/Common/FreezeManager.cs | Removes the “no host => return” behavior; adds host-present/host-absent branching to prevent indefinite freezes. |
| Source/Tests/FreezeManagerTest.cs | New tests validating freeze/unfreeze behavior across host disconnect/reconnect situations. |
| Source/Tests/Helper/DummyConnection.cs | Minimal ConnectionBase implementation for test setup without real networking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (standalone server)
When the host disconnects from a standalone/dedicated server,
FreezeManager.Tick()returns early (if (!Server.PlayingPlayers.Any(p => p.IsHost)) return;), leaving the server frozen indefinitely. Other connected players cannot continue the game even though they are active.This is particularly impactful for standalone server deployments where the host may disconnect and reconnect freely while other players remain connected.
Solution
Modified
FreezeManager.Tick()to handle the host-absent case:frozenstateChanges
Source/Common/FreezeManager.cs: Replaced the early-return guard with a two-branch approachSource/Tests/FreezeManagerTest.cs: 6 new unit tests covering all scenariosSource/Tests/Helper/DummyConnection.cs: Lightweight test double forConnectionBaseTesting
All 71 tests pass (65 existing + 6 new).