refactor(vpn-monitor): kill/restart instead of RPC pause/resume#60
Merged
smartwatermelon merged 2 commits intomainfrom Feb 13, 2026
Merged
Conversation
…/resume Replace the fragile RPC-based pause/resume approach with kill-and-restart: VPN down: 1. Kill Transmission (graceful quit, then force-kill if needed) 2. Verify process is dead 3. Set bind-address to 127.0.0.1 VPN restored: 1. Set bind-address to VPN IP 2. Relaunch Transmission 3. Verify process is running This is more reliable because: - A dead process has zero network activity (no DHT/PEX/tracker leaks) - Transmission persists torrent state in resume files — active torrents resume on relaunch, paused ones stay paused - No RPC dependency for the critical "stop all traffic" path - Eliminates the entire bounded-retry/give-up complexity for resume Removes: pause_all_torrents, resume_all_torrents, RPC session/call functions, TORRENTS_PAUSED_BY_US state, RESUME_RETRY_COUNT logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Transmission only reads BindAddressIPv4 at launch. If the monitor starts while Transmission is already running (e.g., after reboot with a new VPN IP), defaults write alone doesn't take effect. Always kill and relaunch on startup to guarantee the correct bind-address is applied. Found by: Seer Code Review (PR #60) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
Fixed: Seer correctly identified that the startup path skipped restarting Transmission when it was already running. Now always kill/relaunch on startup to guarantee the bind-address is applied (Transmission only reads BindAddressIPv4 at launch). |
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.
Summary
Why this is better
A dead process has zero network activity — no DHT, PEX, or tracker announces can leak. The previous RPC approach left Transmission running (potential leaks) and required bounded-retry logic with give-up notifications for the resume path.
Transmission persists torrent state in its resume files, so previously-active torrents resume on relaunch and paused ones stay paused. No external state tracking needed.
Removed
pause_all_torrents()/resume_all_torrents()RPC functionsget_session_id()/rpc_call()RPC infrastructureTORRENTS_PAUSED_BY_US/RESUME_RETRY_COUNT/MAX_RESUME_RETRIESstate trackingTest plan
🤖 Generated with Claude Code