Skip to content

Commit

Permalink
fixup! Fix bug where block_on was called from an async context
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Jan 7, 2025
1 parent c66d8c2 commit df6f839
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion talpid-wireguard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,13 @@ impl WireguardMonitor {
// timing out on Windows for 2024.9-beta1. These verbose data usage logs are
// a temporary measure to help us understand the issue. They can be removed
// if the issue is resolved.
log_tunnel_data_usage(&config, &tunnel).await;
if let Err(err) =
tokio::task::spawn_blocking(move || log_tunnel_data_usage(&config, &tunnel))
.await
{
log::error!("Failed to log tunnel data during setup phase");
log::error!("{err}");
}
return Err(e);
}

Expand Down Expand Up @@ -1033,6 +1039,8 @@ enum CloseMsg {
pub(crate) trait Tunnel: Send {
fn get_interface_name(&self) -> String;
fn stop(self: Box<Self>) -> std::result::Result<(), TunnelError>;
/// # Note
/// This function should *not* be called from within an async context.
fn get_tunnel_stats(&self) -> std::result::Result<stats::StatsMap, TunnelError>;
fn set_config<'a>(
&'a mut self,
Expand Down

0 comments on commit df6f839

Please sign in to comment.