Skip to content

Commit

Permalink
fixup! Replace occurrences of old Body type in rest mod
Browse files Browse the repository at this point in the history
  • Loading branch information
Serock3 committed Oct 14, 2024
1 parent 7bd7aa7 commit dd2eb9f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mullvad-api/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ impl From<Infallible> for Error {

impl Error {
pub fn is_network_error(&self) -> bool {
matches!(self, Error::HyperError(_) | Error::TimeoutError)
matches!(
self,
Error::HyperError(_) | Error::LegacyHyperError(_) | Error::TimeoutError
)
}

Expand All @@ -96,11 +98,11 @@ impl Error {
return err.raw_os_error() == Some(libc::ENETUNREACH);
}
}
false
}
// TODO: Currently, we use the legacy hyper client for all REST requests. If this
// changes in the future, we likely need to match on `Error::HyperError` here and
// determine how to achieve the equavalent behavior. See DES-1288.
}
// TODO: Match on `Error::HyperError` too?
_ => false,
}
}
Expand Down Expand Up @@ -129,14 +131,16 @@ impl Error {
}
}

// TODO: Look into an alternative to using the legacy hyper client `DES-1288`
type RequestClient =
hyper_util::client::legacy::Client<HttpsConnectorWithSni, BoxBody<Bytes, Error>>;

/// A service that executes HTTP requests, allowing for on-demand termination of all in-flight
/// requests
pub(crate) struct RequestService<T: ConnectionModeProvider> {
command_tx: Weak<mpsc::UnboundedSender<RequestCommand>>,
client: RequestClient,
command_rx: mpsc::UnboundedReceiver<RequestCommand>,
connector_handle: HttpsConnectorWithSniHandle,
client: hyper_util::client::legacy::Client<HttpsConnectorWithSni, BoxBody<Bytes, Error>>,
client: RequestClient,
connection_mode_provider: T,
connection_mode_generation: usize,
Expand Down

0 comments on commit dd2eb9f

Please sign in to comment.