Skip to content

Commit daefbc3

Browse files
committed
minor changes
1 parent 2606322 commit daefbc3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/util.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ where
276276
let mut current_addresses = addresses.as_ptr() as *const IP_ADAPTER_ADDRESSES_LH;
277277
while !current_addresses.is_null() {
278278
unsafe {
279-
callback(*current_addresses)?;
279+
if let Err(e) = callback(*current_addresses) {
280+
log::debug!("Callback returned an error '{}', stopping iteration", e);
281+
break;
282+
}
280283
current_addresses = (*current_addresses).Next;
281284
}
282285
}
@@ -357,7 +360,10 @@ where
357360
let interfaces = unsafe { std::slice::from_raw_parts(first_adapter, adapter_count as usize) };
358361

359362
for interface in interfaces {
360-
callback(*interface)?;
363+
if let Err(e) = callback(*interface) {
364+
log::debug!("Callback returned an error '{}', stopping iteration", e);
365+
break;
366+
}
361367
}
362368
Ok(())
363369
}
@@ -569,8 +575,8 @@ where
569575
let ifaces = from_raw_parts::<MIB_IPINTERFACE_ROW>(&(*if_table).Table[0], (*if_table).NumEntries as usize);
570576
for item in ifaces {
571577
if let Err(e) = callback(item) {
572-
FreeMibTable(if_table as _);
573-
return Err(e);
578+
log::debug!("Callback returned an error '{}', stopping iteration", e);
579+
break;
574580
}
575581
}
576582
FreeMibTable(if_table as _);

0 commit comments

Comments
 (0)