| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tools/quic/quic_server_session.h" | 5 #include "net/tools/quic/quic_server_session.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/quic_crypto_server_config.h" | 7 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 8 #include "net/quic/crypto/quic_random.h" | 8 #include "net/quic/crypto/quic_random.h" |
| 9 #include "net/quic/crypto/source_address_token.h" | 9 #include "net/quic/crypto/source_address_token.h" |
| 10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // There will be no update sent yet - not enough time has passed. | 332 // There will be no update sent yet - not enough time has passed. |
| 333 QuicTime now = QuicTime::Zero(); | 333 QuicTime now = QuicTime::Zero(); |
| 334 session_->OnCongestionWindowChange(now); | 334 session_->OnCongestionWindowChange(now); |
| 335 | 335 |
| 336 // Bandwidth estimate has now changed sufficiently but not enough time has | 336 // Bandwidth estimate has now changed sufficiently but not enough time has |
| 337 // passed to send a Server Config Update. | 337 // passed to send a Server Config Update. |
| 338 bandwidth_estimate_kbytes_per_second = | 338 bandwidth_estimate_kbytes_per_second = |
| 339 bandwidth_estimate_kbytes_per_second * 1.6; | 339 bandwidth_estimate_kbytes_per_second * 1.6; |
| 340 session_->OnCongestionWindowChange(now); | 340 session_->OnCongestionWindowChange(now); |
| 341 | 341 |
| 342 // Bandwidth estimate has now changed sufficiently and enough time has passed. | 342 // Bandwidth estimate has now changed sufficiently and enough time has passed, |
| 343 // but not enough packets have been sent. |
| 343 int64 srtt_ms = | 344 int64 srtt_ms = |
| 344 sent_packet_manager->GetRttStats()->SmoothedRtt().ToMilliseconds(); | 345 sent_packet_manager->GetRttStats()->SmoothedRtt().ToMilliseconds(); |
| 345 now = now.Add(QuicTime::Delta::FromMilliseconds( | 346 now = now.Add(QuicTime::Delta::FromMilliseconds( |
| 346 kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms)); | 347 kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms)); |
| 348 session_->OnCongestionWindowChange(now); |
| 349 |
| 350 // Bandwidth estimate has now changed sufficiently, enough time has passed, |
| 351 // and enough packets have been sent. |
| 352 QuicConnectionPeer::SetSequenceNumberOfLastSentPacket( |
| 353 session_->connection(), kMinPacketsBetweenServerConfigUpdates); |
| 347 | 354 |
| 348 // Verify that the proto has exactly the values we expect. | 355 // Verify that the proto has exactly the values we expect. |
| 349 CachedNetworkParameters expected_network_params; | 356 CachedNetworkParameters expected_network_params; |
| 350 expected_network_params.set_bandwidth_estimate_bytes_per_second( | 357 expected_network_params.set_bandwidth_estimate_bytes_per_second( |
| 351 bandwidth_recorder.BandwidthEstimate().ToBytesPerSecond()); | 358 bandwidth_recorder.BandwidthEstimate().ToBytesPerSecond()); |
| 352 expected_network_params.set_max_bandwidth_estimate_bytes_per_second( | 359 expected_network_params.set_max_bandwidth_estimate_bytes_per_second( |
| 353 bandwidth_recorder.MaxBandwidthEstimate().ToBytesPerSecond()); | 360 bandwidth_recorder.MaxBandwidthEstimate().ToBytesPerSecond()); |
| 354 expected_network_params.set_max_bandwidth_timestamp_seconds( | 361 expected_network_params.set_max_bandwidth_timestamp_seconds( |
| 355 bandwidth_recorder.MaxBandwidthTimestamp()); | 362 bandwidth_recorder.MaxBandwidthTimestamp()); |
| 356 expected_network_params.set_min_rtt_ms(session_->connection() | 363 expected_network_params.set_min_rtt_ms(session_->connection() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 367 EXPECT_CALL(*crypto_stream, | 374 EXPECT_CALL(*crypto_stream, |
| 368 SendServerConfigUpdate(EqualsProto(expected_network_params))) | 375 SendServerConfigUpdate(EqualsProto(expected_network_params))) |
| 369 .Times(1); | 376 .Times(1); |
| 370 session_->OnCongestionWindowChange(now); | 377 session_->OnCongestionWindowChange(now); |
| 371 } | 378 } |
| 372 | 379 |
| 373 } // namespace | 380 } // namespace |
| 374 } // namespace test | 381 } // namespace test |
| 375 } // namespace tools | 382 } // namespace tools |
| 376 } // namespace net | 383 } // namespace net |
| OLD | NEW |