Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Nov 26, 2024
1 parent 7890363 commit 05cf82f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 33 deletions.
2 changes: 1 addition & 1 deletion mullvad-daemon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ impl Daemon {
#[cfg(target_os = "android")]
match event {
AccessMethodEvent::New { setting, .. } => {
// On android mullvad-api invokes protect on a socket to send requests
// On android mullvad-api invokes protect on a socket to send requests
// outside the tunnel
let notifier = self.management_interface.notifier().clone();
tokio::spawn(async move {
Expand Down
42 changes: 16 additions & 26 deletions talpid-core/src/tunnel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use futures::channel::oneshot;
use std::path;
#[cfg(not(target_os = "android"))]
use talpid_routing::RouteManagerHandle;
pub use talpid_tunnel::{TunnelArgs, TunnelEvent, TunnelMetadata};
#[cfg(target_os = "android")]
use talpid_tunnel::tun_provider;
pub use talpid_tunnel::{TunnelArgs, TunnelEvent, TunnelMetadata};
#[cfg(not(target_os = "android"))]
use talpid_types::net::openvpn as openvpn_types;
use talpid_types::net::{wireguard as wireguard_types, TunnelParameters};
Expand Down Expand Up @@ -53,40 +53,30 @@ impl Into<ErrorStateCause> for Error {
Error::EnableIpv6Error => ErrorStateCause::Ipv6Unavailable,

#[cfg(target_os = "android")]
Error::WireguardTunnelMonitoringError(
talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::OtherLegacyAlwaysOnVpn,
),
Error::WireguardTunnelMonitoringError(talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::OtherLegacyAlwaysOnVpn,
),
) => ErrorStateCause::OtherLegacyAlwaysOnVpn,
)) => ErrorStateCause::OtherLegacyAlwaysOnVpn,

#[cfg(target_os = "android")]
Error::WireguardTunnelMonitoringError(
talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::OtherAlwaysOnApp { app_name },
),
Error::WireguardTunnelMonitoringError(talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::OtherAlwaysOnApp { app_name },
),
) => ErrorStateCause::OtherAlwaysOnApp { app_name },
)) => ErrorStateCause::OtherAlwaysOnApp { app_name },

#[cfg(target_os = "android")]
Error::WireguardTunnelMonitoringError(
talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::NotPrepared,
),
),
) => ErrorStateCause::NotPrepared,
Error::WireguardTunnelMonitoringError(talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(tun_provider::Error::NotPrepared),
)) => ErrorStateCause::NotPrepared,

#[cfg(target_os = "android")]
Error::WireguardTunnelMonitoringError(
talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::InvalidDnsServers(addresses),
),
Error::WireguardTunnelMonitoringError(talpid_wireguard::Error::TunnelError(
talpid_wireguard::TunnelError::SetupTunnelDevice(
tun_provider::Error::InvalidDnsServers(addresses),
),
) => ErrorStateCause::InvalidDnsServers(addresses),
)) => ErrorStateCause::InvalidDnsServers(addresses),
#[cfg(target_os = "windows")]
error => match error.get_tunnel_device_error() {
Some(error) => ErrorStateCause::CreateTunnelDevice {
Expand Down
12 changes: 6 additions & 6 deletions talpid-core/src/tunnel_state_machine/connecting_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl ConnectingState {
) -> Self {
let (event_tx, event_rx) = mpsc::unbounded();
let on_tunnel_event =
move |event| -> std::pin::Pin<Box<dyn std::future::Future<Output=()> + Send>> {
move |event| -> std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send>> {
let (tx, rx) = oneshot::channel();
let _ = event_tx.unbounded_send((event, tx));
Box::pin(async move {
Expand Down Expand Up @@ -304,14 +304,14 @@ impl ConnectingState {
None
}
error @ tunnel::Error::WireguardTunnelMonitoringError(..)
if !should_retry(&error, retry_attempt) =>
{
log::error!(
if !should_retry(&error, retry_attempt) =>
{
log::error!(
"{}",
error.display_chain_with_msg("Tunnel has stopped unexpectedly")
);
Some(ErrorStateCause::StartTunnelError)
}
Some(ErrorStateCause::StartTunnelError)
}
error => {
log::warn!(
"{}",
Expand Down

0 comments on commit 05cf82f

Please sign in to comment.