| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 | 1242 |
| 1243 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", | 1243 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", |
| 1244 stats.packets_received); | 1244 stats.packets_received); |
| 1245 | 1245 |
| 1246 if (!session_was_active) | 1246 if (!session_was_active) |
| 1247 return; | 1247 return; |
| 1248 | 1248 |
| 1249 const HostPortPair& server = server_id.host_port_pair(); | 1249 const HostPortPair& server = server_id.host_port_pair(); |
| 1250 // Don't try to change the alternate-protocol state, if the | 1250 // Don't try to change the alternate-protocol state, if the |
| 1251 // alternate-protocol state is unknown. | 1251 // alternate-protocol state is unknown. |
| 1252 if (!http_server_properties_->HasAlternateProtocol(server)) | 1252 const AlternateProtocolInfo alternate = |
| 1253 http_server_properties_->GetAlternateProtocol(server); |
| 1254 if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
| 1253 return; | 1255 return; |
| 1254 | 1256 |
| 1255 // TODO(rch): In the special case where the session has received no | 1257 // TODO(rch): In the special case where the session has received no |
| 1256 // packets from the peer, we should consider blacklisting this | 1258 // packets from the peer, we should consider blacklisting this |
| 1257 // differently so that we still race TCP but we don't consider the | 1259 // differently so that we still race TCP but we don't consider the |
| 1258 // session connected until the handshake has been confirmed. | 1260 // session connected until the handshake has been confirmed. |
| 1259 HistogramBrokenAlternateProtocolLocation( | 1261 HistogramBrokenAlternateProtocolLocation( |
| 1260 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); | 1262 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); |
| 1261 AlternateProtocolInfo alternate = | |
| 1262 http_server_properties_->GetAlternateProtocol(server); | |
| 1263 DCHECK_EQ(QUIC, alternate.protocol); | 1263 DCHECK_EQ(QUIC, alternate.protocol); |
| 1264 | 1264 |
| 1265 // Since the session was active, there's no longer an | 1265 // Since the session was active, there's no longer an |
| 1266 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the | 1266 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the |
| 1267 // TCP job also fails. So to avoid not using QUIC when we otherwise could, | 1267 // TCP job also fails. So to avoid not using QUIC when we otherwise could, |
| 1268 // we mark it as broken, and then immediately re-enable it. This leaves | 1268 // we mark it as broken, and then immediately re-enable it. This leaves |
| 1269 // QUIC as "recently broken" which means that 0-RTT will be disabled but | 1269 // QUIC as "recently broken" which means that 0-RTT will be disabled but |
| 1270 // we'll still race. | 1270 // we'll still race. |
| 1271 http_server_properties_->SetBrokenAlternateProtocol(server); | 1271 http_server_properties_->SetBrokenAlternateProtocol(server); |
| 1272 http_server_properties_->ClearAlternateProtocol(server); | 1272 http_server_properties_->ClearAlternateProtocol(server); |
| 1273 http_server_properties_->SetAlternateProtocol( | 1273 http_server_properties_->SetAlternateProtocol( |
| 1274 server, alternate.port, alternate.protocol, 1); | 1274 server, alternate.port, alternate.protocol, 1); |
| 1275 DCHECK_EQ(QUIC, | 1275 DCHECK_EQ(QUIC, |
| 1276 http_server_properties_->GetAlternateProtocol(server).protocol); | 1276 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1277 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1277 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1278 server)); | 1278 server)); |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 } // namespace net | 1281 } // namespace net |
| OLD | NEW |