Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix access method rotation after dns proxy failure #7678

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ios/MullvadREST/Transport/TransportProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Foundation
import Logging
import MullvadRustRuntime
import MullvadTypes

public final class TransportProvider: RESTTransportProvider, Sendable {
Expand Down Expand Up @@ -38,7 +39,8 @@ public final class TransportProvider: RESTTransportProvider, Sendable {

let currentStrategy = transportStrategy
return TransportWrapper(wrapped: actualTransport) { [weak self] error in
if let error = error as? URLError, error.shouldResetNetworkTransport {
if (error as? URLError)?.shouldResetNetworkTransport ?? false ||
(error as? EncryptedDnsProxyError)?.shouldResetNetworkTransport ?? false {
self?.resetTransportMatching(currentStrategy)
}
}
Expand Down Expand Up @@ -104,6 +106,15 @@ public final class TransportProvider: RESTTransportProvider, Sendable {
}
}

private extension EncryptedDnsProxyError {
var shouldResetNetworkTransport: Bool {
switch self {
case .start:
return true
}
}
}

private extension URLError {
/// Whether the transport selection should be reset.
///
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadRustRuntime/EncryptedDNSProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import MullvadRustRuntimeProxy

enum EncryptedDnsProxyError: Error {
public enum EncryptedDnsProxyError: Error {
case start(err: Int32)
}

Expand Down
Loading