Merged
Conversation
Contributor
There was a problem hiding this comment.
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
DISCONNECTmessage 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.
tsd/apps/interactive/demos/network/client/NetworkUpdateDelegate.cpp
Outdated
Show resolved
Hide resolved
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.
No description provided.