Skip to content

fix(apple): Don't throw when quitting with a stopped tunnel#9231

Merged
jamilbk merged 1 commit into
mainfrom
fix/dont-throw-when-stopping
May 26, 2025
Merged

fix(apple): Don't throw when quitting with a stopped tunnel#9231
jamilbk merged 1 commit into
mainfrom
fix/dont-throw-when-stopping

Conversation

@jamilbk

@jamilbk jamilbk commented May 26, 2025

Copy link
Copy Markdown
Member

If the tunnel is already down when we try to quit the application, we were throwing a harmless error because we mistakenly required a connected status to send the stopTunnel command, which is just a no-op if we're already connected.

Copilot AI review requested due to automatic review settings May 26, 2025 04:06
@vercel

vercel Bot commented May 26, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
firezone ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 4:06am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the stop() method in IPCClient to no longer require a connected tunnel state before calling stopTunnel, preventing an error when quitting with an already stopped tunnel.

  • Removed the status filter (.connected, .connecting, .reasserting) from session() in stop()
  • Now always calls session().stopTunnel() as a no-op if the tunnel is already down
Comments suppressed due to low confidence (1)

swift/apple/FirezoneKit/Sources/FirezoneKit/Helpers/IPCClient.swift:71

  • There's no existing test verifying stop() behavior when the tunnel is already stopped. Consider adding a unit test to confirm it no-ops without throwing in this scenario.
try session().stopTunnel()

@@ -68,7 +68,7 @@ class IPCClient {
}

Copilot AI May 26, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider updating the doc comment for stop() to explain that it no longer requires a connected tunnel and will no-op if the tunnel is already stopped.

Suggested change
/// Stops the tunnel connection.
///
/// This method no longer requires a connected tunnel and will no-op if the tunnel is already stopped.

Copilot uses AI. Check for mistakes.
@jamilbk jamilbk enabled auto-merge May 26, 2025 04:08
@jamilbk jamilbk added this pull request to the merge queue May 26, 2025
Merged via the queue into main with commit ec682d5 May 26, 2025
111 checks passed
@jamilbk jamilbk deleted the fix/dont-throw-when-stopping branch May 26, 2025 04:32
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