Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet committed Apr 8, 2024
1 parent 6d03a7e commit 4914ec8
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
3 changes: 2 additions & 1 deletion ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,8 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
guard tunnelManager.deviceState.isLoggedIn else { return false }

switch tunnelManager.tunnelStatus.state {
case .connected, .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .error, .negotiatingKey:
case .connected, .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .error,
.negotiatingPostQuantumKey:
tunnelManager.reconnectTunnel(selectNewRelay: true)

case .disconnecting, .disconnected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class MapConnectionStatusOperation: AsyncOperation {
return connectionState.isNetworkReachable
? .connecting(connectionState.selectedRelay)
: .waitingForConnectivity(.noConnection)
case let .negotiatingPostQuantumKey(connectionState):
connectionState.isNetworkReachable
? .negotiatingPostQuantumKey(connectionState.selectedRelay)
case let .negotiatingPostQuantumKey(connectionState, privateKey):
return connectionState.isNetworkReachable
? .negotiatingPostQuantumKey(connectionState.selectedRelay, privateKey)
: .waitingForConnectivity(.noConnection)
case let .reconnecting(connectionState):
return connectionState.isNetworkReachable
Expand Down
3 changes: 2 additions & 1 deletion ios/MullvadVPN/TunnelManager/StopTunnelOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class StopTunnelOperation: ResultOperation<Void> {

finish(result: .success(()))

case .connected, .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .error, .negotiatingKey:
case .connected, .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .error,
.negotiatingPostQuantumKey:
doShutDownTunnel()

case .disconnected, .disconnecting, .pendingReconnect, .waitingForConnectivity(.noNetwork):
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/TunnelManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ final class TunnelManager: StorePaymentObserver {
// while the tunnel process is trying to connect.
startPollingTunnelStatus(interval: establishingTunnelStatusPollInterval)

case .negotiatingKey:
case .negotiatingPostQuantumKey:
// No need to poll the tunnel while negotiating post quantum keys, assume the connection will work
break

Expand Down
9 changes: 5 additions & 4 deletions ios/MullvadVPN/TunnelManager/TunnelState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import MullvadTypes
import PacketTunnelCore
import WireGuardKitTypes

/// A struct describing the tunnel status.
struct TunnelStatus: Equatable, CustomStringConvertible {
Expand Down Expand Up @@ -51,7 +52,7 @@ enum TunnelState: Equatable, CustomStringConvertible {
case connecting(SelectedRelay?)

/// Negotiating a key for post-quantum resistance
case negotiatingKey(SelectedRelay)
case negotiatingPostQuantumKey(SelectedRelay, PrivateKey)

/// Connected the tunnel
case connected(SelectedRelay)
Expand Down Expand Up @@ -97,7 +98,7 @@ enum TunnelState: Equatable, CustomStringConvertible {
"waiting for connectivity"
case let .error(blockedStateReason):
"error state: \(blockedStateReason)"
case let .negotiatingKey(tunnelRelay):
case let .negotiatingPostQuantumKey(tunnelRelay, _):
"negotiating key with \(tunnelRelay.hostname)"
}
}
Expand All @@ -109,14 +110,14 @@ enum TunnelState: Equatable, CustomStringConvertible {
true
case .pendingReconnect, .disconnecting, .disconnected, .waitingForConnectivity(.noNetwork), .error:
false
case .negotiatingKey:
case .negotiatingPostQuantumKey:
false
}
}

var relay: SelectedRelay? {
switch self {
case let .connected(relay), let .reconnecting(relay), let .negotiatingKey(relay):
case let .connected(relay), let .reconnecting(relay), let .negotiatingPostQuantumKey(relay, _):
relay
case let .connecting(relay):
relay
Expand Down
14 changes: 8 additions & 6 deletions ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ final class TunnelControlView: UIView {
private extension TunnelState {
var textColorForSecureLabel: UIColor {
switch self {
case .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .negotiatingKey:
case .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .negotiatingPostQuantumKey:
.white

case .connected:
Expand Down Expand Up @@ -484,7 +484,7 @@ private extension TunnelState {
)

// TODO: Is this the correct message here ?
case .negotiatingKey:
case .negotiatingPostQuantumKey:
NSLocalizedString(
"TUNNEL_STATE_NEGOTIATING_KEY",
tableName: "Main",
Expand Down Expand Up @@ -567,7 +567,8 @@ private extension TunnelState {
comment: ""
)

case .negotiatingKey:
// TODO: Is this correct ?
case .negotiatingPostQuantumKey:
NSLocalizedString(
"SWITCH_LOCATION_BUTTON_TITLE",
tableName: "Main",
Expand All @@ -587,7 +588,8 @@ private extension TunnelState {
comment: ""
)

case .negotiatingKey:
// TODO: Is this correct ?
case .negotiatingPostQuantumKey:
NSLocalizedString(
"TUNNEL_STATE_CONNECTING_ACCESSIBILITY_LABEL",
tableName: "Main",
Expand Down Expand Up @@ -672,7 +674,7 @@ private extension TunnelState {
.waitingForConnectivity(.noConnection):
[.selectLocation, .cancel]

case .negotiatingKey:
case .negotiatingPostQuantumKey:
[.selectLocation, .cancel]

case .connected, .reconnecting, .error:
Expand All @@ -688,7 +690,7 @@ private extension TunnelState {
.waitingForConnectivity(.noConnection):
[.cancel]

case .negotiatingKey:
case .negotiatingPostQuantumKey:
[.cancel]
case .connected, .reconnecting, .error:
[.disconnect]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TunnelViewController: UIViewController, RootContainment {
contentView.setAnimatingActivity(true)
mapViewController.setCenter(tunnelRelay?.location.geoCoordinate, animated: animated)

case let .reconnecting(tunnelRelay), let .negotiatingKey(tunnelRelay):
case let .reconnecting(tunnelRelay), let .negotiatingPostQuantumKey(tunnelRelay, _):
mapViewController.removeLocationMarker()
contentView.setAnimatingActivity(true)
mapViewController.setCenter(tunnelRelay.location.geoCoordinate, animated: animated)
Expand Down
4 changes: 0 additions & 4 deletions ios/PacketTunnelCore/Actor/PacketTunnelActor+KeyPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ extension PacketTunnelActor {
// Move currentKey into keyPolicy.
stateData.keyPolicy = .usePrior(currentKey, startKeySwitchTask())
stateData.currentKey = nil

}

_ = state.mutateConnectionState(connectionStateMutator) ||
state.mutateBlockedState(blockedStateMutator)
}

/**
Expand Down
2 changes: 0 additions & 2 deletions ios/PacketTunnelCore/Actor/State+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ extension State {
let .disconnecting(connState): connState
default: nil
}
return modified
}

var blockedData: State.BlockingData? {
Expand Down Expand Up @@ -149,7 +148,6 @@ extension State {

default:
break

}
}

Expand Down

0 comments on commit 4914ec8

Please sign in to comment.