mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Fix failure to display Cake Tins in web UI
Cake Diff functions now use "checked_sub" to ensure that an overflow doesn't mess up data. Web UI includes checks that Cake data is available on each history tick.
This commit is contained in:
parent
5be5111954
commit
05bb1ee959
@ -262,8 +262,16 @@
|
|||||||
if (tin == 0) {
|
if (tin == 0) {
|
||||||
qlenX1.push(counter);
|
qlenX1.push(counter);
|
||||||
qlenX2.push(counter);
|
qlenX2.push(counter);
|
||||||
qlenY1.push(data.history[i][0].Cake.qlen);
|
if (data.history[i][0].Cake) {
|
||||||
qlenY2.push(0.0 - data.history[i][1].Cake.qlen);
|
qlenY1.push(data.history[i][0].Cake.qlen);
|
||||||
|
} else {
|
||||||
|
qlenY1.push(0);
|
||||||
|
}
|
||||||
|
if (data.history[i][1].Cake) {
|
||||||
|
qlenY2.push(0.0 - data.history[i][1].Cake.qlen);
|
||||||
|
} else {
|
||||||
|
qlenY2.push(0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
@ -273,8 +281,16 @@
|
|||||||
if (tin == 0) {
|
if (tin == 0) {
|
||||||
qlenX1.push(counter);
|
qlenX1.push(counter);
|
||||||
qlenX2.push(counter);
|
qlenX2.push(counter);
|
||||||
qlenY1.push(data.history[i][0].Cake.qlen);
|
if (data.history[i][0].Cake) {
|
||||||
qlenY2.push(0.0 - data.history[i][1].Cake.qlen);
|
qlenY1.push(data.history[i][0].Cake.qlen);
|
||||||
|
} else {
|
||||||
|
qlenY1.push(0.0);
|
||||||
|
}
|
||||||
|
if (data.history[i][1].Cake) {
|
||||||
|
qlenY2.push(0.0 - data.history[i][1].Cake.qlen);
|
||||||
|
} else {
|
||||||
|
qlenY2.push(0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,11 @@ fn cake_diff(previous: &QueueType, current: &QueueType) -> Result<QueueDiff> {
|
|||||||
.iter()
|
.iter()
|
||||||
.zip(prev.tins.iter())
|
.zip(prev.tins.iter())
|
||||||
.map(|(new, prev)| {
|
.map(|(new, prev)| {
|
||||||
//println!("{} - {} = {}", new.sent_bytes, prev.sent_bytes, new.sent_bytes -prev.sent_bytes);
|
|
||||||
CakeDiffTin {
|
CakeDiffTin {
|
||||||
sent_bytes: new.sent_bytes - prev.sent_bytes,
|
sent_bytes: new.sent_bytes.checked_sub(prev.sent_bytes).unwrap_or(0),
|
||||||
backlog_bytes: new.backlog_bytes,
|
backlog_bytes: new.backlog_bytes,
|
||||||
drops: new.drops - prev.drops,
|
drops: new.drops - prev.drops,
|
||||||
marks: new.ecn_marks - prev.ecn_marks,
|
marks: new.ecn_marks.checked_sub(prev.ecn_marks).unwrap_or(0),
|
||||||
avg_delay_us: new.avg_delay_us,
|
avg_delay_us: new.avg_delay_us,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user