Skip to content

Commit 476afec

Browse files
committed
Make the actor reconnect reason explicit
1 parent 66336ae commit 476afec

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Diff for: ios/PacketTunnelCore/Actor/PacketTunnelActor+Public.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extension PacketTunnelActor {
3838

3939
- Parameter nextRelay: next relay to connect to.
4040
*/
41-
public nonisolated func reconnect(to nextRelay: NextRelay, reconnectReason: ActorReconnectReason = .userInitiated) {
41+
public nonisolated func reconnect(to nextRelay: NextRelay, reconnectReason: ActorReconnectReason) {
4242
eventChannel.send(.reconnect(nextRelay, reason: reconnectReason))
4343
}
4444

Diff for: ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ extension SettingsReaderStub {
4646
relayConstraints: RelayConstraints(),
4747
dnsServers: .gateway,
4848
obfuscation: WireGuardObfuscationSettings(state: .off, port: .automatic),
49-
quantumResistance: .on
49+
quantumResistance: .on,
50+
multihopState: .off
5051
)
5152
return SettingsReaderStub {
5253
return staticSettings

Diff for: ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ final class PacketTunnelActorTests: XCTestCase {
383383
reconnectingStateExpectation.fulfill()
384384
}
385385

386-
actor.reconnect(to: .random)
386+
actor.reconnect(to: .random, reconnectReason: .userInitiated)
387387

388388
await fulfillment(
389389
of: [reconnectingStateExpectation],
@@ -414,7 +414,7 @@ final class PacketTunnelActorTests: XCTestCase {
414414
let reconnectingState: (ObservedState) -> Bool = { if case .reconnecting = $0 { true } else { false } }
415415
await expect(reconnectingState, on: actor) { reconnectingStateExpectation.fulfill() }
416416

417-
actor.reconnect(to: .random)
417+
actor.reconnect(to: .random, reconnectReason: .userInitiated)
418418
await fulfillment(
419419
of: [reconnectingStateExpectation],
420420
timeout: Duration.milliseconds(100).timeInterval
@@ -445,7 +445,7 @@ final class PacketTunnelActorTests: XCTestCase {
445445
// Cancel the state sink to avoid overfulfilling the connected expectation
446446
stateSink?.cancel()
447447

448-
actor.reconnect(to: .random)
448+
actor.reconnect(to: .random, reconnectReason: .userInitiated)
449449
await fulfillment(of: [stopMonitorExpectation], timeout: 1)
450450
}
451451
}

0 commit comments

Comments
 (0)