Skip to content

Commit

Permalink
Merge branch 'release/159.0.2-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoreymendez committed Jun 26, 2024
2 parents de8a98b + 27b2330 commit cde956d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Sources/NetworkProtection/PacketTunnelProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1542,19 +1542,25 @@ open class PacketTunnelProvider: NEPacketTunnelProvider {

// MARK: - Computer sleeping

@MainActor
public override func sleep() async {
os_log("Sleep", log: .networkProtectionSleepLog, type: .info)

await connectionTester.stop()
await tunnelFailureMonitor.stop()
await latencyMonitor.stop()
await entitlementMonitor.stop()
await serverStatusMonitor.stop()
await stopMonitors()
}

@MainActor
public override func wake() {
os_log("Wake up", log: .networkProtectionSleepLog, type: .info)

// macOS can launch the extension due to calls to `sendProviderMessage`, so there's
// a chance this is being called when the VPN isn't really meant to be connected or
// running. We want to avoid firing pixels or handling adapter changes when this is
// the case.
guard connectionStatus != .disconnected else {
return
}

Task {
providerEvents.fire(.tunnelWakeAttempt(.begin))

Expand Down

0 comments on commit cde956d

Please sign in to comment.