Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4d65979

Browse files
committedFeb 24, 2025·
comments
1 parent db11801 commit 4d65979

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎Coder Desktop/VPN/PacketTunnelProvider.swift

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
5050
logger.info("startTunnel called")
5151
guard manager == nil else {
5252
logger.error("startTunnel called with non-nil Manager")
53+
// If the tunnel is already running, then we can just mark as connected.
5354
completionHandler(nil)
5455
return
5556
}
@@ -123,6 +124,8 @@ class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
123124
logger.error("error stopping manager: \(error.description, privacy: .public)")
124125
}
125126
globalXPCListenerDelegate.vpnXPCInterface.manager = nil
127+
// Mark teardown as complete by setting manager to nil, and
128+
// calling the completion handler.
126129
self.manager = nil
127130
completionHandler()
128131
}
@@ -142,6 +145,8 @@ class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
142145
}
143146

144147
override func wake() {
148+
// It's possible the tunnel is still starting up, if it is, wake should
149+
// be a no-op.
145150
guard !reasserting else { return }
146151
guard manager == nil else {
147152
logger.error("wake called with non-nil Manager")

0 commit comments

Comments
 (0)
Please sign in to comment.