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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 network_stats); | 1312 network_stats); |
1313 return; | 1313 return; |
1314 } | 1314 } |
1315 | 1315 |
1316 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", | 1316 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", |
1317 stats.packets_received); | 1317 stats.packets_received); |
1318 | 1318 |
1319 if (!session_was_active) | 1319 if (!session_was_active) |
1320 return; | 1320 return; |
1321 | 1321 |
1322 const HostPortPair& server = server_id.host_port_pair(); | |
1323 // Don't try to change the alternate-protocol state, if the | |
1324 // alternate-protocol state is unknown. | |
1325 const AlternateProtocolInfo alternate = | |
1326 http_server_properties_->GetAlternateProtocol(server); | |
1327 if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | |
1328 return; | |
1329 | |
1330 // TODO(rch): In the special case where the session has received no | 1322 // TODO(rch): In the special case where the session has received no |
1331 // packets from the peer, we should consider blacklisting this | 1323 // packets from the peer, we should consider blacklisting this |
1332 // differently so that we still race TCP but we don't consider the | 1324 // differently so that we still race TCP but we don't consider the |
1333 // session connected until the handshake has been confirmed. | 1325 // session connected until the handshake has been confirmed. |
1334 HistogramBrokenAlternateProtocolLocation( | 1326 HistogramBrokenAlternateProtocolLocation( |
1335 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); | 1327 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); |
1336 DCHECK_EQ(QUIC, alternate.protocol); | |
1337 | 1328 |
1338 // Since the session was active, there's no longer an | 1329 // Since the session was active, there's no longer an |
1339 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the | 1330 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1340 // TCP job also fails. So to avoid not using QUIC when we otherwise could, | 1331 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1341 // we mark it as broken, and then immediately re-enable it. This leaves | 1332 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1342 // QUIC as "recently broken" which means that 0-RTT will be disabled but | 1333 // still race. |
1343 // we'll still race. | 1334 const HostPortPair& server = server_id.host_port_pair(); |
1344 http_server_properties_->SetBrokenAlternateProtocol(server); | 1335 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1345 http_server_properties_->ClearAlternateProtocol(server); | 1336 AlternativeService(QUIC, server.host(), server.port())); |
1346 http_server_properties_->SetAlternateProtocol( | |
1347 server, alternate.port, alternate.protocol, 1); | |
1348 DCHECK_EQ(QUIC, | |
1349 http_server_properties_->GetAlternateProtocol(server).protocol); | |
1350 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | |
1351 server)); | |
1352 } | 1337 } |
1353 | 1338 |
1354 } // namespace net | 1339 } // namespace net |
OLD | NEW |