Set supported preset on start
This commit is contained in:
parent
6f1fe36412
commit
d44e9f861b
|
@ -275,6 +275,9 @@ public class ConnectionService: Codable {
|
|||
providerProfile.poolId = fallbackPool.id
|
||||
}
|
||||
|
||||
// XXX: fix unsupported preset
|
||||
providerProfile.setSupportedPreset()
|
||||
|
||||
profile = providerProfile
|
||||
|
||||
case .host:
|
||||
|
|
|
@ -76,6 +76,16 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||
presetId = infrastructure.defaults.preset
|
||||
}
|
||||
|
||||
public func setSupportedPreset() {
|
||||
guard let pool = pool else {
|
||||
return
|
||||
}
|
||||
let supported = pool.supportedPresetIds(in: infrastructure)
|
||||
if let current = preset?.id, !supported.contains(current), let fallback = supported.first {
|
||||
presetId = fallback
|
||||
}
|
||||
}
|
||||
|
||||
private func validateEndpoint() {
|
||||
guard let pool = pool, let preset = preset else {
|
||||
manualAddress = nil
|
||||
|
|
Loading…
Reference in New Issue