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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 NetworkChangeNotifier::RemoveNetworkObserver(this); | 681 NetworkChangeNotifier::RemoveNetworkObserver(this); |
682 } else if (close_sessions_on_ip_change_) { | 682 } else if (close_sessions_on_ip_change_) { |
683 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 683 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { | 687 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { |
688 require_confirmation_ = require_confirmation; | 688 require_confirmation_ = require_confirmation; |
689 if (!(local_address_ == IPEndPoint())) { | 689 if (!(local_address_ == IPEndPoint())) { |
690 http_server_properties_->SetSupportsQuic(!require_confirmation, | 690 http_server_properties_->SetSupportsQuic(!require_confirmation, |
691 local_address_.address()); | 691 local_address_.address().bytes()); |
692 } | 692 } |
693 } | 693 } |
694 | 694 |
695 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { | 695 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { |
696 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); | 696 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); |
697 } | 697 } |
698 | 698 |
699 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( | 699 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( |
700 const QuicServerId& server_id) { | 700 const QuicServerId& server_id) { |
701 if (!delay_tcp_race_ || require_confirmation_) | 701 if (!delay_tcp_race_ || require_confirmation_) |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 if (rv != OK) { | 1336 if (rv != OK) { |
1337 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1337 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
1338 return rv; | 1338 return rv; |
1339 } | 1339 } |
1340 | 1340 |
1341 socket->GetLocalAddress(&local_address_); | 1341 socket->GetLocalAddress(&local_address_); |
1342 if (check_persisted_supports_quic_) { | 1342 if (check_persisted_supports_quic_) { |
1343 check_persisted_supports_quic_ = false; | 1343 check_persisted_supports_quic_ = false; |
1344 IPAddressNumber last_address; | 1344 IPAddressNumber last_address; |
1345 if (http_server_properties_->GetSupportsQuic(&last_address) && | 1345 if (http_server_properties_->GetSupportsQuic(&last_address) && |
1346 last_address == local_address_.address()) { | 1346 last_address == local_address_.address().bytes()) { |
1347 require_confirmation_ = false; | 1347 require_confirmation_ = false; |
1348 } | 1348 } |
1349 } | 1349 } |
1350 | 1350 |
1351 return OK; | 1351 return OK; |
1352 } | 1352 } |
1353 | 1353 |
1354 int QuicStreamFactory::CreateSession(const QuicServerId& server_id, | 1354 int QuicStreamFactory::CreateSession(const QuicServerId& server_id, |
1355 int cert_verify_flags, | 1355 int cert_verify_flags, |
1356 scoped_ptr<QuicServerInfo> server_info, | 1356 scoped_ptr<QuicServerInfo> server_info, |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 // Since the session was active, there's no longer an | 1598 // Since the session was active, there's no longer an |
1599 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1599 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1600 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1600 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1601 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1601 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1602 // still race. | 1602 // still race. |
1603 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1603 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1604 alternative_service); | 1604 alternative_service); |
1605 } | 1605 } |
1606 | 1606 |
1607 } // namespace net | 1607 } // namespace net |
OLD | NEW |