Skip to content

Added suspension detection to filesync client, to restart connection#16

Merged
guydols merged 2 commits into
mainfrom
dev
May 28, 2026
Merged

Added suspension detection to filesync client, to restart connection#16
guydols merged 2 commits into
mainfrom
dev

Conversation

@guydols

@guydols guydols commented May 28, 2026

Copy link
Copy Markdown
Owner

This pull request introduces support for detecting system suspend and resume events in GUI mode, allowing the filesync client to immediately reconnect after a system resume. The main addition is a new SuspendDetector utility, which is integrated into the GUI manager's session loop. This improves user experience by minimizing sync delays after a laptop or system wakes up from sleep. The change also includes basic tests for the new detector.

Suspend/resume detection feature:

  • Added a new SuspendDetector utility (crates/filesync/src/suspend_detector.rs) that detects system suspend/resume by comparing wall-clock time with system uptime. On Linux, it reads /proc/uptime; on other platforms, it returns an unsupported error. ([crates/filesync/src/suspend_detector.rsR1-R71](https://github.com/guydols/ByteHive/pull/16/files#diff-e854a36d80dc4cdaf7f9cca2c9f03d1c25719e7e10b5d06b974b6ba3844e5aa0R1-R71))
  • Integrated SuspendDetector into the GUI manager's session loop (crates/filesync/src/gui/manager.rs) to monitor for resume events and trigger immediate reconnection and user notification when a resume is detected. ([[1]](https://github.com/guydols/ByteHive/pull/16/files#diff-c6988c71cce54d886165a6e24dbe5234246e9ea011093c216a7783b138583b12R5), [[2]](https://github.com/guydols/ByteHive/pull/16/files#diff-c6988c71cce54d886165a6e24dbe5234246e9ea011093c216a7783b138583b12R86-R95), [[3]](https://github.com/guydols/ByteHive/pull/16/files#diff-c6988c71cce54d886165a6e24dbe5234246e9ea011093c216a7783b138583b12L145-R150))
  • Documented the new suspend/resume detection feature in the README for GUI mode. ([crates/filesync/README.mdR343-R344](https://github.com/guydols/ByteHive/pull/16/files#diff-0be06c3d53c35473f47aad38f0a1bbebc7578e8e099cb380428a3ec360002a84R343-R344))

Testing and module organization:

  • Added basic tests for SuspendDetector to ensure it initializes, implements Default, and its main method does not panic during normal operation (crates/filesync/tests/test_suspend_detector.rs). ([crates/filesync/tests/test_suspend_detector.rsR1-R27](https://github.com/guydols/ByteHive/pull/16/files#diff-2e52b2f7b05be8af788583df441bbb9efe076aac8f58912be15d747a4678746aR1-R27))
  • Registered the new suspend_detector module in the crate root (crates/filesync/src/lib.rs). ([crates/filesync/src/lib.rsR11](https://github.com/guydols/ByteHive/pull/16/files#diff-6de8e376aa17b37bb20763deed1e531218c6af89ad8e01571e55d27bc74f3b43R11))

@guydols guydols self-assigned this May 28, 2026
@guydols guydols merged commit c0afe05 into main May 28, 2026
2 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.

1 participant