| 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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 active_jobs_.erase(server_id); | 1028 active_jobs_.erase(server_id); |
| 1029 job_requests_map_.erase(requests_iter); | 1029 job_requests_map_.erase(requests_iter); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) { | 1032 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) { |
| 1033 active_cert_verifier_jobs_.erase(job->server_id()); | 1033 active_cert_verifier_jobs_.erase(job->server_id()); |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 bool QuicStreamFactory::IsQuicBroken(QuicChromiumClientSession* session) { |
| 1037 const AlternativeService alternative_service( |
| 1038 kProtoQUIC, session->server_id().host_port_pair()); |
| 1039 if (!http_server_properties_->IsAlternativeServiceBroken( |
| 1040 alternative_service)) { |
| 1041 return false; |
| 1042 } |
| 1043 // No longer send requests to a server for which QUIC is broken, but |
| 1044 // continue to service existing requests. |
| 1045 OnSessionGoingAway(session); |
| 1046 return true; |
| 1047 } |
| 1048 |
| 1036 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} | 1049 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} |
| 1037 | 1050 |
| 1038 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) { | 1051 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) { |
| 1039 const AliasSet& aliases = session_aliases_[session]; | 1052 const AliasSet& aliases = session_aliases_[session]; |
| 1040 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); | 1053 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); |
| 1041 ++it) { | 1054 ++it) { |
| 1042 const QuicServerId& server_id = it->server_id(); | 1055 const QuicServerId& server_id = it->server_id(); |
| 1043 DCHECK(active_sessions_.count(server_id)); | 1056 DCHECK(active_sessions_.count(server_id)); |
| 1044 DCHECK_EQ(session, active_sessions_[server_id]); | 1057 DCHECK_EQ(session, active_sessions_[server_id]); |
| 1045 // Track sessions which have recently gone away so that we can disable | 1058 // Track sessions which have recently gone away so that we can disable |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 // Since the session was active, there's no longer an | 1713 // Since the session was active, there's no longer an |
| 1701 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1714 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1702 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1715 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1703 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1716 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1704 // still race. | 1717 // still race. |
| 1705 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1718 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1706 alternative_service); | 1719 alternative_service); |
| 1707 } | 1720 } |
| 1708 | 1721 |
| 1709 } // namespace net | 1722 } // namespace net |
| OLD | NEW |