Skip to content

Network server state fixes#215

Merged
jeffamstutz merged 11 commits intonext_releasefrom
server_state_fixes
Feb 5, 2026
Merged

Network server state fixes#215
jeffamstutz merged 11 commits intonext_releasefrom
server_state_fixes

Conversation

@jeffamstutz
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 5, 2026 02:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes network server state management issues, improves API design, and adds support for graceful client disconnection. The changes refactor the network channel lifecycle management and introduce a proper state machine for handling connection/disconnection cycles.

Changes:

  • Refactored NetworkChannel to use std::optional<WorkGuard> for proper io_context lifecycle management and changed message handling to use shared pointers to prevent race conditions
  • Introduced a new DISCONNECT message type and added support for explicit client disconnection with proper server-side handling
  • Moved make_message() functions from public Message API to private NetworkChannel methods and simplified send() API with convenient overloads

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tsd/src/tsd/ui/imgui/windows/LayerTree.cpp Updated UI text to better reflect network client state
tsd/src/tsd/network/NetworkChannel.hpp Added <optional> for WorkGuard, changed method signatures to use shared_ptr for messages, added send() overloads, added restart() method, moved make_message() to private
tsd/src/tsd/network/NetworkChannel.cpp Refactored constructor/start/stop lifecycle, changed message handling to use shared pointers, added restart() implementation, fixed start_accept() to only execute callbacks on success, simplified disconnect()
tsd/src/tsd/network/Message.hpp Removed make_message() functions (moved to NetworkChannel)
tsd/apps/interactive/demos/network/server/RenderServer.hpp Refactored state machine to use m_currentMode and m_nextMode separately
tsd/apps/interactive/demos/network/server/RenderServer.cpp Implemented two-stage state machine, added DISCONNECT handler, updated to use simplified send() API
tsd/apps/interactive/demos/network/client/tsdTestClient.cpp Updated to use simplified send() API
tsd/apps/interactive/demos/network/client/tsdRemoteViewer.cpp Added DISCONNECT message on disconnect, improved sceneLoadComplete lifecycle management
tsd/apps/interactive/demos/network/client/RemoteViewport.cpp Updated to use simplified send() API
tsd/apps/interactive/demos/network/client/NetworkUpdateDelegate.cpp Added .get() to all send() calls to make updates synchronous
tsd/apps/interactive/demos/network/RenderSession.hpp Added DISCONNECT message type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeffamstutz jeffamstutz merged commit 45ec374 into next_release Feb 5, 2026
5 checks passed
@jeffamstutz jeffamstutz deleted the server_state_fixes branch February 5, 2026 16:53
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.

1 participant