Skip to content

android: harden detached connect timeout gate (refactor branch port of #8696)#8698

Merged
myleshorton merged 1 commit intogarmr/radiance-daemon-refactorfrom
fisk/port-timeout-fix-to-refactor
Apr 23, 2026
Merged

android: harden detached connect timeout gate (refactor branch port of #8696)#8698
myleshorton merged 1 commit intogarmr/radiance-daemon-refactorfrom
fisk/port-timeout-fix-to-refactor

Conversation

@myleshorton
Copy link
Copy Markdown
Contributor

Cherry-pick of #8696 (8998d94ac) onto the refactor branch.

The refactor branch already includes #8689 (0540dc9ab), which introduced the connectInFlight single-flight gate with the try { connect() } finally { connectInFlight.set(false) } pattern. That pattern leaves the gate permanently wedged if the coroutine body never starts (pre-dispatch cancellation) — after which every future connect attempt is rejected with IllegalStateException until the process is killed.

#8696 moves the reset to deferred.invokeOnCompletion { ... }, which fires on every terminal Deferred state, including immediate cancellation. Happy path and JNI-still-running timeout path are unchanged.

Clean cherry-pick, no conflicts. Diff is identical to what landed on main.

Test plan

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 23, 2026 19:24
@myleshorton myleshorton merged commit 3b04b85 into garmr/radiance-daemon-refactor Apr 23, 2026
2 checks passed
@myleshorton myleshorton deleted the fisk/port-timeout-fix-to-refactor branch April 23, 2026 19:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cherry-picks the main-branch fix from #8696 onto the refactor branch to prevent the Android VPN connectInFlight single-flight gate from getting stuck when the async coroutine is cancelled before its body starts (pre-dispatch cancellation).

Changes:

  • Move connectInFlight reset from an async { try/finally } block into deferred.invokeOnCompletion { ... } so the flag clears for all terminal Deferred states (including immediate cancellation).
  • Update the surrounding comment to reflect the new reset mechanism and the “early cancellation” wedge scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants