| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 678 } |
| 679 if (close_sessions_on_ip_change_) { | 679 if (close_sessions_on_ip_change_) { |
| 680 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 680 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { | 684 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { |
| 685 require_confirmation_ = require_confirmation; | 685 require_confirmation_ = require_confirmation; |
| 686 if (!(local_address_ == IPEndPoint())) { | 686 if (!(local_address_ == IPEndPoint())) { |
| 687 http_server_properties_->SetSupportsQuic(!require_confirmation, | 687 http_server_properties_->SetSupportsQuic(!require_confirmation, |
| 688 local_address_.address()); | 688 local_address_.address().bytes()); |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 | 691 |
| 692 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { | 692 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { |
| 693 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); | 693 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); |
| 694 } | 694 } |
| 695 | 695 |
| 696 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( | 696 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( |
| 697 const QuicServerId& server_id) { | 697 const QuicServerId& server_id) { |
| 698 if (!delay_tcp_race_ || require_confirmation_) | 698 if (!delay_tcp_race_ || require_confirmation_) |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 if (rv != OK) { | 1257 if (rv != OK) { |
| 1258 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1258 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1259 return rv; | 1259 return rv; |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 socket->GetLocalAddress(&local_address_); | 1262 socket->GetLocalAddress(&local_address_); |
| 1263 if (check_persisted_supports_quic_) { | 1263 if (check_persisted_supports_quic_) { |
| 1264 check_persisted_supports_quic_ = false; | 1264 check_persisted_supports_quic_ = false; |
| 1265 IPAddressNumber last_address; | 1265 IPAddressNumber last_address; |
| 1266 if (http_server_properties_->GetSupportsQuic(&last_address) && | 1266 if (http_server_properties_->GetSupportsQuic(&last_address) && |
| 1267 last_address == local_address_.address()) { | 1267 last_address == local_address_.address().bytes()) { |
| 1268 require_confirmation_ = false; | 1268 require_confirmation_ = false; |
| 1269 } | 1269 } |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 DefaultPacketWriterFactory packet_writer_factory(socket.get()); | 1272 DefaultPacketWriterFactory packet_writer_factory(socket.get()); |
| 1273 | 1273 |
| 1274 if (!helper_.get()) { | 1274 if (!helper_.get()) { |
| 1275 helper_.reset( | 1275 helper_.reset( |
| 1276 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(), | 1276 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(), |
| 1277 clock_.get(), random_generator_)); | 1277 clock_.get(), random_generator_)); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 // Since the session was active, there's no longer an | 1472 // Since the session was active, there's no longer an |
| 1473 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1473 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1474 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1474 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1475 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1475 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1476 // still race. | 1476 // still race. |
| 1477 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1477 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1478 alternative_service); | 1478 alternative_service); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 } // namespace net | 1481 } // namespace net |
| OLD | NEW |