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

Unified Diff: net/tools/quic/quic_time_wait_list_manager.cc

Issue 2125303002: Use overloaded operators with QuicTime for addition, subtraction and scalar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126402784
Patch Set: Created 4 years, 5 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/tools/quic/quic_socket_utils.cc ('k') | net/tools/quic/quic_time_wait_list_manager_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_time_wait_list_manager.cc
diff --git a/net/tools/quic/quic_time_wait_list_manager.cc b/net/tools/quic/quic_time_wait_list_manager.cc
index 6686238a03cf7859e8372befdaca945dc9536e8e..ffe3dd4df00925c5c789d0e85f72850e73828440 100644
--- a/net/tools/quic/quic_time_wait_list_manager.cc
+++ b/net/tools/quic/quic_time_wait_list_manager.cc
@@ -267,9 +267,8 @@ void QuicTimeWaitListManager::SetConnectionIdCleanUpAlarm() {
QuicTime oldest_connection_id =
connection_id_map_.begin()->second.time_added;
QuicTime now = clock_->ApproximateNow();
- if (now.Subtract(oldest_connection_id) < time_wait_period_) {
- next_alarm_interval =
- oldest_connection_id.Add(time_wait_period_).Subtract(now);
+ if (now - oldest_connection_id < time_wait_period_) {
+ next_alarm_interval = oldest_connection_id + time_wait_period_ - now;
} else {
LOG(ERROR) << "ConnectionId lingered for longer than time_wait_period_";
}
@@ -278,8 +277,8 @@ void QuicTimeWaitListManager::SetConnectionIdCleanUpAlarm() {
next_alarm_interval = time_wait_period_;
}
- connection_id_clean_up_alarm_->Set(
- clock_->ApproximateNow().Add(next_alarm_interval));
+ connection_id_clean_up_alarm_->Set(clock_->ApproximateNow() +
+ next_alarm_interval);
}
bool QuicTimeWaitListManager::MaybeExpireOldestConnection(
@@ -300,7 +299,7 @@ bool QuicTimeWaitListManager::MaybeExpireOldestConnection(
void QuicTimeWaitListManager::CleanUpOldConnectionIds() {
QuicTime now = clock_->ApproximateNow();
- QuicTime expiration = now.Subtract(time_wait_period_);
+ QuicTime expiration = now - time_wait_period_;
while (MaybeExpireOldestConnection(expiration)) {
}
« no previous file with comments | « net/tools/quic/quic_socket_utils.cc ('k') | net/tools/quic/quic_time_wait_list_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698