mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
fix(windows): avoid pnet interface enumeration panic (#2031)
This commit is contained in:
@@ -221,7 +221,8 @@ fn get_or_create_worker(interface_name: &str) -> io::Result<Arc<InterfaceWorker>
|
||||
|
||||
// But creation is rare.
|
||||
// Let's find interface first.
|
||||
let interfaces = datalink::interfaces();
|
||||
let interfaces = std::panic::catch_unwind(datalink::interfaces)
|
||||
.map_err(|_| io::Error::other("failed to enumerate network interfaces: pnet panicked"))?;
|
||||
let interface = interfaces
|
||||
.into_iter()
|
||||
.find(|iface| iface.name == interface_name)
|
||||
|
||||
Reference in New Issue
Block a user