diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | talpid-core/src/tunnel/wireguard/mod.rs | 19 |
2 files changed, 12 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6520ee1cc1..5d02cd2409 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Line wrap the file at 100 chars. Th - Make GUI WireGuard key verification resilient to failure. - Fix issue where daemon would try and connect with UDP when the tunnel protocol is set to OpenVPN and the bridge mode is set to "On". +- Don't start ping monitor loop if first ping fails when checking WireGuard connection. #### macOS - Unregister the app properly from the OS when running the bundled `uninstall.sh` script. diff --git a/talpid-core/src/tunnel/wireguard/mod.rs b/talpid-core/src/tunnel/wireguard/mod.rs index 71ef1a83b3..1eecfe8f85 100644 --- a/talpid-core/src/tunnel/wireguard/mod.rs +++ b/talpid-core/src/tunnel/wireguard/mod.rs @@ -4,7 +4,7 @@ use self::config::Config; use super::{tun_provider::TunProvider, TunnelEvent, TunnelMetadata}; use crate::routing; use std::{collections::HashMap, io, path::Path, sync::mpsc}; -use talpid_types::BoxedError; +use talpid_types::{BoxedError, ErrorExt}; pub mod config; mod ping_monitor; @@ -115,16 +115,19 @@ impl WireguardMonitor { match ping_monitor::ping(gateway, PING_TIMEOUT, &iface_name, true) { Ok(()) => { (on_event)(TunnelEvent::Up(metadata)); + + if let Err(e) = ping_monitor::monitor_ping(gateway, PING_TIMEOUT, &iface_name) { + log::trace!("Ping monitor failed - {}", e); + } } - Err(e) => { - log::error!("First ping to gateway failed - {}", e); - let _ = close_sender.send(CloseMsg::PingErr); + Err(error) => { + log::error!( + "{}", + error.display_chain_with_msg("First ping to gateway failed") + ); } - }; - - if let Err(e) = ping_monitor::monitor_ping(gateway, PING_TIMEOUT, &iface_name) { - log::trace!("Ping monitor failed - {}", e); } + let _ = close_sender.send(CloseMsg::PingErr); }); |
