Conversation
…sion Previously the suspend/resume detector was only polled while paused or during the fixed backoff wait between reconnect attempts, never while a session was actively connected. Since the client sets no TCP keepalive, a session that was live when the machine slept would resume holding a dead socket with no way to detect it, so filesystem changes queued up and silently failed to reach the server. - Client now tracks its active Connection and shutdown() force-closes it, reusing the existing disconnect/reconnect error handling. - gui::manager::session_loop spawns a dedicated suspend-monitor thread that runs for the life of the sync session and force-disconnects the active client (or skips the backoff wait) the moment a resume is detected, so reconnect + rescan happens the same way as at startup.
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.
This pull request improves how the filesync client and GUI manager handle system suspend and resume events, ensuring that active connections are force-closed and sessions are promptly restarted after a resume. The main changes introduce a mechanism to track and close in-flight connections, and refactor the session loop to coordinate reconnects more reliably.
Connection management and forced disconnects:
active_connfield to theClientstruct, protected by aMutex, to track the currently active connection. This allowsshutdown()to force-close the connection even if the client is blocked in a session. [1] [2]ActiveConnGuardRAII struct to ensureactive_connis cleared when a session ends, preventing stale references.Client::shutdown()to force-close any active connection, unblocking any threads waiting on network I/O.Client::session()to check for shutdown before connecting and to set/clear theactive_connslot appropriately during the session lifecycle. [1] [2]GUI session loop and suspend/resume handling:
session_loopto maintain anactive_clientreference, allowing the suspend-monitor thread to callshutdown()on the current client. Also introduced aresume_pendingflag to coordinate immediate reconnects after resume. [1] [2] [3]These changes make the filesync client more robust in the face of system suspend/resume events, reducing downtime and improving user experience.