From c2a6ad3391356b0e59810fbb63cea4b009505bd9 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:37:25 +0800 Subject: [PATCH] minor changes --- src/util.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/util.rs b/src/util.rs index 53f5d64..d6a4110 100644 --- a/src/util.rs +++ b/src/util.rs @@ -276,7 +276,10 @@ where let mut current_addresses = addresses.as_ptr() as *const IP_ADAPTER_ADDRESSES_LH; while !current_addresses.is_null() { unsafe { - callback(*current_addresses)?; + if let Err(e) = callback(*current_addresses) { + log::debug!("Callback in GetAdaptersAddresses error '{}', stopping iteration", e); + break; + } current_addresses = (*current_addresses).Next; } } @@ -357,7 +360,10 @@ where let interfaces = unsafe { std::slice::from_raw_parts(first_adapter, adapter_count as usize) }; for interface in interfaces { - callback(*interface)?; + if let Err(e) = callback(*interface) { + log::debug!("Callback in GetInterfaceInfo error '{}', stopping iteration", e); + break; + } } Ok(()) } @@ -569,8 +575,8 @@ where let ifaces = from_raw_parts::(&(*if_table).Table[0], (*if_table).NumEntries as usize); for item in ifaces { if let Err(e) = callback(item) { - FreeMibTable(if_table as _); - return Err(e); + log::debug!("Callback in GetInterfaceInfo error '{}', stopping iteration", e); + break; } } FreeMibTable(if_table as _);