KM-16992: make sure to disconnect when user taps disconnect - #359
Conversation
kp-mario-nachbaur
commented
Jul 14, 2026
- disconnect() in all three tunnel profiles now stops the tunnel immediately, not only after saveToPreferences succeeds, and stops it again afterward (on-demand rules can resurrect it in between). Also clears a stale pending connect-wait observer and syncs UI status when the tunnel was already dead.
- DefaultVPNProvider.disconnect() no longer blocks on fetching the tunnel log before disconnecting (it's now fire-and-forget, since a wedged tunnel may never reply).
- VPNDaemon and DefaultVPNProvider's reconnect/retry logic now check disconnectedManually so they never auto-reconnect after the user has explicitly disconnected — including mid-flight reconnects and the fallback retry timer.
- connect() clears disconnectedManually since a new connection attempt supersedes the prior manual-disconnect intent.
|
Claude finished @kp-mario-nachbaur's task in 2m 39s —— View job PR Review: KM-16992 — make sure to disconnect when user taps disconnect
Overall this is a solid, well-reasoned fix. The inline comments explaining why each 🐛 Correctness / behavior1. Direct UI status write bypasses the daemon's The new "tunnel already dead → sync UI" block writes Consider guarding the direct write on 2. Error paths stop the tunnel but never disable on-demand When 🧵 Threading / races3.
4. 🧹 Maintainability5. The three implementations are nearly identical (waitObserver teardown, stop-before-save, UI sync, on-demand disable, stop-after-save). This is easy to drift out of sync — a future fix to one will likely miss the others. Consider extracting the shared body into a 6. ✅ TestsNo tests were added/changed (
🔎 Impacted flows to test manually
|
KB review —
|
|
Claude finished @kp-mario-nachbaur's task in 2m 14s —— View job PR Review: KM-16992 — make sure to disconnect when user taps disconnect
This synchronize was a merge of 🔁 Interaction with the new 20s retry delay (#361, merged in)The longer retry interval makes two parts of this PR more important, not less:
No code change needed — just confirming the merge doesn't undermine the fix. 🐛 Still-open correctness items (from prior review, unchanged in code)1. Direct UI status write bypasses the daemon's 2. Error paths stop the tunnel but never disable on-demand — 🧵 Threading (low risk, worth confirming)3. 4. 🧹 Maintainability5. 6. Fire-and-forget log capture ( ✅ Tests — still the biggest gap
🔎 Manual flows to verify
Overall: solid fix, well-commented, and the merged retry-delay bump only reinforces its value. Items #1 and the test gap are the two I'd most want addressed before merge. |