Skip to content

Commit

Permalink
Fix compiler concurrency warnings, targeted level
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson committed Sep 23, 2024
1 parent 0495209 commit 54b8c2b
Show file tree
Hide file tree
Showing 38 changed files with 67 additions and 67 deletions.
4 changes: 2 additions & 2 deletions ios/MullvadREST/Relay/RelaySelectorProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public protocol RelaySelectorProtocol {
}

/// Struct describing the selected relay.
public struct SelectedRelay: Equatable, Codable {
public struct SelectedRelay: Equatable, Codable, Sendable {
/// Selected relay endpoint.
public let endpoint: MullvadEndpoint

Expand All @@ -43,7 +43,7 @@ extension SelectedRelay: CustomDebugStringConvertible {
}
}

public struct SelectedRelays: Equatable, Codable {
public struct SelectedRelays: Equatable, Codable, Sendable {
public let entry: SelectedRelay?
public let exit: SelectedRelay
public let retryAttempt: UInt
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/AnyIPEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import protocol Network.IPAddress

public enum AnyIPEndpoint: Hashable, Equatable, Codable, CustomStringConvertible {
public enum AnyIPEndpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable {
case ipv4(IPv4Endpoint)
case ipv6(IPv6Endpoint)

Expand Down
6 changes: 3 additions & 3 deletions ios/MullvadTypes/Cancellable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public protocol Cancellable {
extension Operation: Cancellable {}

/// An object representing a cancellation token.
public final class AnyCancellable: Cancellable {
private let block: (() -> Void)?
public final class AnyCancellable: Cancellable, Sendable {
private let block: (@Sendable () -> Void)?

/// Create cancellation token with block handler.
public init(block: @escaping () -> Void) {
public init(block: @Sendable @escaping () -> Void) {
self.block = block
}

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/IPv4Endpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import Network

public struct IPv4Endpoint: Hashable, Equatable, Codable, CustomStringConvertible {
public struct IPv4Endpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable {
public let ip: IPv4Address
public let port: UInt16

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/IPv6Endpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import Network

public struct IPv6Endpoint: Hashable, Equatable, Codable, CustomStringConvertible {
public struct IPv6Endpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable {
public let ip: IPv6Address
public let port: UInt16

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import CoreLocation
import Foundation

public struct Location: Codable, Equatable {
public struct Location: Codable, Equatable, Sendable {
public var country: String
public var countryCode: String
public var city: String
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/MullvadEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import Network

/// Contains server data needed to connect to a single mullvad endpoint.
public struct MullvadEndpoint: Equatable, Codable {
public struct MullvadEndpoint: Equatable, Codable, Sendable {
public let ipv4Relay: IPv4Endpoint
public let ipv6Relay: IPv6Endpoint?
public let ipv4Gateway: IPv4Address
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/RelayConstraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

private let anyConstraint = "any"

public enum RelayConstraint<T>: Codable, Equatable,
public enum RelayConstraint<T: Sendable>: Codable, Equatable, Sendable,
CustomDebugStringConvertible where T: Codable & Equatable {
case any
case only(T)
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/RelayConstraints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible {
public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible, Sendable {
@available(*, deprecated, renamed: "locations")
private var location: RelayConstraint<RelayLocation> = .only(.country("se"))

Expand Down
4 changes: 2 additions & 2 deletions ios/MullvadTypes/RelayFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import Foundation

public struct RelayFilter: Codable, Equatable {
public enum Ownership: Codable {
public struct RelayFilter: Codable, Equatable, Sendable {
public enum Ownership: Codable, Sendable {
case any
case owned
case rented
Expand Down
6 changes: 3 additions & 3 deletions ios/MullvadTypes/RelayLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible {
public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible, Sendable {
case country(String)
case city(String, String)
case hostname(String, String, String)
Expand Down Expand Up @@ -107,7 +107,7 @@ public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible {
}
}

public struct UserSelectedRelays: Codable, Equatable {
public struct UserSelectedRelays: Codable, Equatable, Sendable {
public let locations: [RelayLocation]
public let customListSelection: CustomListSelection?

Expand All @@ -118,7 +118,7 @@ public struct UserSelectedRelays: Codable, Equatable {
}

extension UserSelectedRelays {
public struct CustomListSelection: Codable, Equatable {
public struct CustomListSelection: Codable, Equatable, Sendable {
/// The ID of the custom list that the selected relays belong to.
public let listId: UUID
/// Whether the selected relays are subnodes or the custom list itself.
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadTypes/TransportLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public enum TransportLayer: Codable {
public enum TransportLayer: Codable, Sendable {
case udp
case tcp
}
16 changes: 8 additions & 8 deletions ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6664,7 +6664,7 @@
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -6704,7 +6704,7 @@
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -6810,7 +6810,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -6869,7 +6869,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand Down Expand Up @@ -7514,7 +7514,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -7819,7 +7819,7 @@
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -8356,7 +8356,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand Down Expand Up @@ -8657,7 +8657,7 @@
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = minimal;
SWIFT_STRICT_CONCURRENCY = targeted;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ final class PacketTunnelPathObserver: DefaultPathObserverProtocol {
}
}

extension NetworkExtension.NWPath: NetworkPath {}
extension NetworkExtension.NWPath: @retroactive NetworkPath, @unchecked Sendable {}
4 changes: 2 additions & 2 deletions ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
//

import Foundation
import MullvadLogging
@preconcurrency import MullvadLogging
import MullvadTypes
import NetworkExtension
import PacketTunnelCore
import WireGuardKit
@preconcurrency import WireGuardKit

struct WgAdapter: TunnelAdapterProtocol {
let logger = Logger(label: "WgAdapter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//

import MullvadREST
import WireGuardKitTypes
@preconcurrency import WireGuardKitTypes

public enum EphemeralPeerNegotiationState: Equatable {
public enum EphemeralPeerNegotiationState: Equatable, Sendable {
case single(EphemeralPeerRelayConfiguration)
case multi(entry: EphemeralPeerRelayConfiguration, exit: EphemeralPeerRelayConfiguration)

Expand All @@ -25,7 +25,7 @@ public enum EphemeralPeerNegotiationState: Equatable {
}
}

public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConvertible {
public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConvertible, Sendable {
public let relay: SelectedRelay
public let configuration: EphemeralPeerConfiguration

Expand All @@ -39,7 +39,7 @@ public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConve
}
}

public struct EphemeralPeerConfiguration: Equatable, CustomDebugStringConvertible {
public struct EphemeralPeerConfiguration: Equatable, CustomDebugStringConvertible, Sendable {
public let privateKey: PrivateKey
public let preSharedKey: PreSharedKey?
public let allowedIPs: [IPAddressRange]
Expand Down
8 changes: 4 additions & 4 deletions ios/PacketTunnelCore/Actor/ObservedState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Foundation
import MullvadREST
import MullvadTypes
import Network
import WireGuardKitTypes
@preconcurrency import WireGuardKitTypes

/// A serializable representation of internal state.
public enum ObservedState: Equatable, Codable {
public enum ObservedState: Equatable, Codable, Sendable {
case initial
case connecting(ObservedConnectionState)
case reconnecting(ObservedConnectionState)
Expand All @@ -26,7 +26,7 @@ public enum ObservedState: Equatable, Codable {
}

/// A serializable representation of internal connection state.
public struct ObservedConnectionState: Equatable, Codable {
public struct ObservedConnectionState: Equatable, Codable, Sendable {
public var selectedRelays: SelectedRelays
public var relayConstraints: RelayConstraints
public var networkReachability: NetworkReachability
Expand Down Expand Up @@ -65,7 +65,7 @@ public struct ObservedConnectionState: Equatable, Codable {
}

/// A serializable representation of internal blocked state.
public struct ObservedBlockedState: Equatable, Codable {
public struct ObservedBlockedState: Equatable, Codable, Sendable {
public var reason: BlockedStateReason
public var relayConstraints: RelayConstraints?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Actor+ConnectionMonitoring.swift
// PacketTunnelActor+ConnectionMonitoring.swift
// PacketTunnelCore
//
// Created by pronebird on 26/09/2023.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import MullvadTypes
import Network
import WireGuardKitTypes
@preconcurrency import WireGuardKitTypes

extension PacketTunnelActor {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

@preconcurrency import Combine
import Foundation

extension PacketTunnelActor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import WireGuardKitTypes
@preconcurrency import WireGuardKitTypes

extension PacketTunnelActor {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Actor+SleepCycle.swift
// PacketTunnelActor+SleepCycle.swift
// PacketTunnelCore
//
// Created by pronebird on 26/09/2023.
Expand Down
4 changes: 2 additions & 2 deletions ios/PacketTunnelCore/Actor/PacketTunnelActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
//

import Foundation
import MullvadLogging
@preconcurrency import MullvadLogging
import MullvadREST
import MullvadRustRuntime
import MullvadSettings
import MullvadTypes
import NetworkExtension
import WireGuardKitTypes
@preconcurrency import WireGuardKitTypes

/**
Packet tunnel state machine implemented as an actor.
Expand Down
2 changes: 1 addition & 1 deletion ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import WireGuardKitTypes

extension PacketTunnelActor {
/// Describes events that the state machine handles. These can be user commands or non-user-initiated events
enum Event {
enum Event: Sendable {
/// Start tunnel.
case start(StartOptions)

Expand Down
2 changes: 1 addition & 1 deletion ios/PacketTunnelCore/Actor/PacketTunnelActorReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import WireGuardKitTypes

extension PacketTunnelActor {
/// A structure encoding an effect; each event will yield zero or more of those, which can then be sequentially executed.
enum Effect: Equatable {
enum Effect: Equatable, Sendable {
case startDefaultPathObserver
case stopDefaultPathObserver
case startTunnelMonitor
Expand Down
Loading

0 comments on commit 54b8c2b

Please sign in to comment.