Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: net/quic/quic_bandwidth.cc

Issue 684043002: Protect against the divide by zero error in QuicBandwidth::TransferTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Add_QUIC_connection_option_NTLP_78465187
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/send_algorithm_interface.h ('k') | net/quic/quic_bandwidth_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_bandwidth.cc
diff --git a/net/quic/quic_bandwidth.cc b/net/quic/quic_bandwidth.cc
index cdd2986b1675faf51d72c66f2cb284bce6711f4a..dbce39d354908a30c431dc7b5776ea795181f07c 100644
--- a/net/quic/quic_bandwidth.cc
+++ b/net/quic/quic_bandwidth.cc
@@ -100,6 +100,9 @@ QuicBandwidth QuicBandwidth::Scale(float scale_factor) const {
}
QuicTime::Delta QuicBandwidth::TransferTime(QuicByteCount bytes) const {
+ if (bits_per_second_ == 0) {
+ return QuicTime::Delta::Zero();
+ }
return QuicTime::Delta::FromMicroseconds(
bytes * 8 * base::Time::kMicrosecondsPerSecond / bits_per_second_);
}
« no previous file with comments | « net/quic/congestion_control/send_algorithm_interface.h ('k') | net/quic/quic_bandwidth_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698