summaryrefslogtreecommitdiffstats
path: root/vendor/sysinfo/src/windows/network.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sysinfo/src/windows/network.rs')
-rw-r--r--vendor/sysinfo/src/windows/network.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/vendor/sysinfo/src/windows/network.rs b/vendor/sysinfo/src/windows/network.rs
index 6a09a0490..9ad551f82 100644
--- a/vendor/sysinfo/src/windows/network.rs
+++ b/vendor/sysinfo/src/windows/network.rs
@@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
+use crate::common::MacAddr;
+use crate::network::refresh_networks_addresses;
use crate::{NetworkExt, NetworksExt, NetworksIter};
use std::collections::{hash_map, HashMap};
@@ -100,7 +102,7 @@ impl NetworksExt for Networks {
};
match self.interfaces.entry(interface_name) {
hash_map::Entry::Occupied(mut e) => {
- let mut interface = e.get_mut();
+ let interface = e.get_mut();
old_and_new!(interface, current_out, old_out, ptr.OutOctets);
old_and_new!(interface, current_in, old_in, ptr.InOctets);
old_and_new!(
@@ -137,6 +139,7 @@ impl NetworksExt for Networks {
old_errors_in: ptr.InErrors,
errors_out: ptr.OutErrors,
old_errors_out: ptr.OutErrors,
+ mac_addr: MacAddr::UNSPECIFIED,
updated: true,
});
}
@@ -146,6 +149,8 @@ impl NetworksExt for Networks {
}
// Remove interfaces which are gone.
self.interfaces.retain(|_, d| d.updated);
+ // Refresh all interfaces' addresses.
+ refresh_networks_addresses(&mut self.interfaces);
}
fn refresh(&mut self) {
@@ -196,6 +201,7 @@ pub struct NetworkData {
errors_out: u64,
old_errors_out: u64,
updated: bool,
+ pub(crate) mac_addr: MacAddr,
}
impl NetworkExt for NetworkData {
@@ -246,4 +252,8 @@ impl NetworkExt for NetworkData {
fn total_errors_on_transmitted(&self) -> u64 {
self.errors_out
}
+
+ fn mac_address(&self) -> MacAddr {
+ self.mac_addr
+ }
}