@@ -939,16 +939,16 @@ final class TunnelManager: StorePaymentObserver {
939
939
let operation = AsyncBlockOperation ( dispatchQueue: internalQueue) {
940
940
let currentSettings = self . _tunnelSettings
941
941
var updatedSettings = self . _tunnelSettings
942
+ let settingsStrategy = TunnelSettingsStrategy ( )
942
943
943
944
modificationBlock ( & updatedSettings)
944
945
945
- // Select new relay only when relay constraints change.
946
- let currentConstraints = currentSettings. relayConstraints
947
- let updatedConstraints = updatedSettings. relayConstraints
948
- let selectNewRelay = currentConstraints != updatedConstraints
949
-
950
946
self . setSettings ( updatedSettings, persist: true )
951
- self . reconnectTunnel ( selectNewRelay: selectNewRelay, completionHandler: nil )
947
+ self . reconnectTunnel (
948
+ selectNewRelay: settingsStrategy
949
+ . shouldReconnectToNewRelay ( oldSettings: currentSettings, newSettings: updatedSettings) ,
950
+ completionHandler: nil
951
+ )
952
952
}
953
953
954
954
operation. completionBlock = {
@@ -1146,27 +1146,27 @@ extension TunnelManager {
1146
1146
1147
1147
```
1148
1148
func delay(seconds: UInt) async throws {
1149
- try await Task.sleep(nanoseconds: UInt64(seconds) * 1_000_000_000)
1149
+ try await Task.sleep(nanoseconds: UInt64(seconds) * 1_000_000_000)
1150
1150
}
1151
1151
1152
1152
Task {
1153
- print("Wait 5 seconds")
1154
- try await delay(seconds: 5)
1153
+ print("Wait 5 seconds")
1154
+ try await delay(seconds: 5)
1155
1155
1156
- print("Simulate active account")
1157
- self.tunnelManager.simulateAccountExpiration(option: .active)
1158
- try await delay(seconds: 5)
1156
+ print("Simulate active account")
1157
+ self.tunnelManager.simulateAccountExpiration(option: .active)
1158
+ try await delay(seconds: 5)
1159
1159
1160
- print("Simulate close to expiry")
1161
- self.tunnelManager.simulateAccountExpiration(option: .closeToExpiry)
1162
- try await delay(seconds: 10)
1160
+ print("Simulate close to expiry")
1161
+ self.tunnelManager.simulateAccountExpiration(option: .closeToExpiry)
1162
+ try await delay(seconds: 10)
1163
1163
1164
- print("Simulate expired account")
1165
- self.tunnelManager.simulateAccountExpiration(option: .expired)
1166
- try await delay(seconds: 5)
1164
+ print("Simulate expired account")
1165
+ self.tunnelManager.simulateAccountExpiration(option: .expired)
1166
+ try await delay(seconds: 5)
1167
1167
1168
- print("Simulate active account")
1169
- self.tunnelManager.simulateAccountExpiration(option: .active)
1168
+ print("Simulate active account")
1169
+ self.tunnelManager.simulateAccountExpiration(option: .active)
1170
1170
}
1171
1171
```
1172
1172
0 commit comments