summaryrefslogtreecommitdiffstats
path: root/vendor/sysinfo/src/windows/network.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/sysinfo/src/windows/network.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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
+ }
}