summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src/device
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2023-10-18 19:23:03 +0200
committerDavid Lönnhager <david.l@mullvad.net>2023-10-19 16:51:59 +0200
commit4e5d08ebbc2cb49304ff0c2f4c77ecc11be30c79 (patch)
treed6458f600d151347b99f52a0082157ee52b7e37f /mullvad-daemon/src/device
parent58b09e84af5a921af3b4db213d717bc2b0a03770 (diff)
downloadmullvadvpn-4e5d08ebbc2cb49304ff0c2f4c77ecc11be30c79.tar.xz
mullvadvpn-4e5d08ebbc2cb49304ff0c2f4c77ecc11be30c79.zip
Fold all access token requests into a single request
Diffstat (limited to 'mullvad-daemon/src/device')
-rw-r--r--mullvad-daemon/src/device/service.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/mullvad-daemon/src/device/service.rs b/mullvad-daemon/src/device/service.rs
index fdda61297f..a56cf10b48 100644
--- a/mullvad-daemon/src/device/service.rs
+++ b/mullvad-daemon/src/device/service.rs
@@ -14,7 +14,7 @@ use talpid_types::net::wireguard::PrivateKey;
use super::{Error, PrivateAccountAndDevice, PrivateDevice};
use mullvad_api::{
availability::ApiAvailabilityHandle,
- rest::{self, Error as RestError, MullvadRestHandle},
+ rest::{self, MullvadRestHandle},
AccountsProxy, DevicesProxy,
};
use talpid_core::future_retry::{retry_future, ConstantInterval, ExponentialBackoff, Jittered};
@@ -402,7 +402,7 @@ pub fn spawn_account_service(
}
fn handle_expiry_result_inner(
- result: &Result<chrono::DateTime<chrono::Utc>, mullvad_api::rest::Error>,
+ result: &Result<chrono::DateTime<chrono::Utc>, rest::Error>,
api_availability: &ApiAvailabilityHandle,
) -> bool {
match result {
@@ -425,18 +425,18 @@ fn handle_expiry_result_inner(
}
}
-fn should_retry<T>(result: &Result<T, RestError>, api_handle: &ApiAvailabilityHandle) -> bool {
+fn should_retry<T>(result: &Result<T, rest::Error>, api_handle: &ApiAvailabilityHandle) -> bool {
match result {
Err(error) if error.is_network_error() => !api_handle.get_state().is_offline(),
_ => false,
}
}
-fn should_retry_backoff<T>(result: &Result<T, RestError>) -> bool {
+fn should_retry_backoff<T>(result: &Result<T, rest::Error>) -> bool {
match result {
Ok(_) => false,
Err(error) => {
- if let RestError::ApiError(status, code) = error {
+ if let rest::Error::ApiError(status, code) = error {
*status != rest::StatusCode::NOT_FOUND
&& code != mullvad_api::DEVICE_NOT_FOUND
&& code != mullvad_api::INVALID_ACCOUNT
@@ -451,7 +451,7 @@ fn should_retry_backoff<T>(result: &Result<T, RestError>) -> bool {
fn map_rest_error(error: rest::Error) -> Error {
match error {
- RestError::ApiError(_status, ref code) => match code.as_str() {
+ rest::Error::ApiError(_status, ref code) => match code.as_str() {
// TODO: Implement invalid payment
mullvad_api::DEVICE_NOT_FOUND => Error::InvalidDevice,
mullvad_api::INVALID_ACCOUNT => Error::InvalidAccount,