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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 } | 678 } |
679 | 679 |
680 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { | 680 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { |
681 require_confirmation_ = require_confirmation; | 681 require_confirmation_ = require_confirmation; |
682 if (!(local_address_ == IPEndPoint())) { | 682 if (!(local_address_ == IPEndPoint())) { |
683 http_server_properties_->SetSupportsQuic(!require_confirmation, | 683 http_server_properties_->SetSupportsQuic(!require_confirmation, |
684 local_address_.address()); | 684 local_address_.address()); |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
| 688 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { |
| 689 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); |
| 690 } |
| 691 |
688 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( | 692 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( |
689 const QuicServerId& server_id) { | 693 const QuicServerId& server_id) { |
690 if (!delay_tcp_race_ || require_confirmation_) | 694 if (!delay_tcp_race_ || require_confirmation_) |
691 return base::TimeDelta(); | 695 return base::TimeDelta(); |
692 int64 srtt = 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); | 696 int64 srtt = 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
693 // Picked 300ms based on mean time from | 697 // Picked 300ms based on mean time from |
694 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. | 698 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. |
695 const int kDefaultRTT = 300 * kNumMicrosPerMilli; | 699 const int kDefaultRTT = 300 * kNumMicrosPerMilli; |
696 if (!srtt) | 700 if (!srtt) |
697 srtt = kDefaultRTT; | 701 srtt = kDefaultRTT; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 // Since the session was active, there's no longer an | 1457 // Since the session was active, there's no longer an |
1454 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1458 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1455 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1459 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1456 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1460 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1457 // still race. | 1461 // still race. |
1458 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1462 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1459 alternative_service); | 1463 alternative_service); |
1460 } | 1464 } |
1461 | 1465 |
1462 } // namespace net | 1466 } // namespace net |
OLD | NEW |