refactor(main): simplify interface stats direction logic
Remove the ifb/veth interface prefix detection from interface_stats_directions. The function now unconditionally returns RX for download and TX for upload, as the previous heuristic was unreliable and the simplified behavior matches actual usage.
This commit is contained in:
1 file changed
+2
-18
+2
-18
@@ -155,24 +155,8 @@ fn install_signal_handlers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn interface_stats_directions(settings: &Settings) -> (StatsDirection, StatsDirection) {
|
fn interface_stats_directions(_: &Settings) -> (StatsDirection, StatsDirection) {
|
||||||
let download = if settings.network.download_interface.starts_with("ifb")
|
(StatsDirection::RX, StatsDirection::TX)
|
||||||
|| settings.network.download_interface.starts_with("veth")
|
|
||||||
{
|
|
||||||
StatsDirection::TX
|
|
||||||
} else {
|
|
||||||
StatsDirection::RX
|
|
||||||
};
|
|
||||||
|
|
||||||
let upload = if settings.network.upload_interface.starts_with("ifb")
|
|
||||||
|| settings.network.upload_interface.starts_with("veth")
|
|
||||||
{
|
|
||||||
StatsDirection::RX
|
|
||||||
} else {
|
|
||||||
StatsDirection::TX
|
|
||||||
};
|
|
||||||
|
|
||||||
(download, upload)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn probe_identifier() -> u16 {
|
fn probe_identifier() -> u16 {
|
||||||
|
|||||||
Reference in new issue
Block a user