mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-24 20:25:00 +00:00
bbr: avoid unwrapping another checked Option value
This commit is contained in:
committed by
Benjamin Saunders
parent
4630670655
commit
8da9cf55e5
@@ -80,14 +80,13 @@ impl BandwidthEstimation {
|
||||
u64::MAX // will take the min of send and ack, so this is just a skip
|
||||
};
|
||||
|
||||
let ack_rate = if self.prev_acked_time.is_none() {
|
||||
0
|
||||
} else {
|
||||
BandwidthEstimation::bw_from_delta(
|
||||
let ack_rate = match self.prev_acked_time {
|
||||
Some(prev_acked_time) => BandwidthEstimation::bw_from_delta(
|
||||
self.total_acked - self.prev_total_acked,
|
||||
now - self.prev_acked_time.unwrap(),
|
||||
now - prev_acked_time,
|
||||
)
|
||||
.unwrap_or(0)
|
||||
.unwrap_or(0),
|
||||
None => 0,
|
||||
};
|
||||
|
||||
let bandwidth = send_rate.min(ack_rate);
|
||||
|
||||
Reference in New Issue
Block a user