OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_server_session_base.h" | 5 #include "net/quic/quic_server_session_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/proto/cached_network_parameters.pb.h" | 8 #include "net/quic/proto/cached_network_parameters.pb.h" |
9 #include "net/quic/quic_bug_tracker.h" | 9 #include "net/quic/quic_bug_tracker.h" |
10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (HasDataToWrite()) { | 109 if (HasDataToWrite()) { |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 // If not enough time has passed since the last time we sent an update to the | 113 // If not enough time has passed since the last time we sent an update to the |
114 // client, or not enough packets have been sent, then return early. | 114 // client, or not enough packets have been sent, then return early. |
115 const QuicSentPacketManagerInterface& sent_packet_manager = | 115 const QuicSentPacketManagerInterface& sent_packet_manager = |
116 connection()->sent_packet_manager(); | 116 connection()->sent_packet_manager(); |
117 int64_t srtt_ms = | 117 int64_t srtt_ms = |
118 sent_packet_manager.GetRttStats()->smoothed_rtt().ToMilliseconds(); | 118 sent_packet_manager.GetRttStats()->smoothed_rtt().ToMilliseconds(); |
119 int64_t now_ms = now.Subtract(last_scup_time_).ToMilliseconds(); | 119 int64_t now_ms = (now - last_scup_time_).ToMilliseconds(); |
120 int64_t packets_since_last_scup = | 120 int64_t packets_since_last_scup = |
121 connection()->packet_number_of_last_sent_packet() - | 121 connection()->packet_number_of_last_sent_packet() - |
122 last_scup_packet_number_; | 122 last_scup_packet_number_; |
123 if (now_ms < (kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms) || | 123 if (now_ms < (kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms) || |
124 now_ms < kMinIntervalBetweenServerConfigUpdatesMs || | 124 now_ms < kMinIntervalBetweenServerConfigUpdatesMs || |
125 packets_since_last_scup < kMinPacketsBetweenServerConfigUpdates) { | 125 packets_since_last_scup < kMinPacketsBetweenServerConfigUpdates) { |
126 return; | 126 return; |
127 } | 127 } |
128 | 128 |
129 // If the bandwidth recorder does not have a valid estimate, return early. | 129 // If the bandwidth recorder does not have a valid estimate, return early. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( | 249 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( |
250 const QuicBandwidth& bandwidth) { | 250 const QuicBandwidth& bandwidth) { |
251 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); | 251 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); |
252 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) | 252 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) |
253 ? INT32_MAX | 253 ? INT32_MAX |
254 : static_cast<int32_t>(bytes_per_second)); | 254 : static_cast<int32_t>(bytes_per_second)); |
255 } | 255 } |
256 | 256 |
257 } // namespace net | 257 } // namespace net |
OLD | NEW |