| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 QuicClientSession* session = active_sessions_[host_port_proxy_pair]; | 418 QuicClientSession* session = active_sessions_[host_port_proxy_pair]; |
| 419 DCHECK(session); | 419 DCHECK(session); |
| 420 return scoped_ptr<QuicHttpStream>( | 420 return scoped_ptr<QuicHttpStream>( |
| 421 new QuicHttpStream(session->GetWeakPtr())); | 421 new QuicHttpStream(session->GetWeakPtr())); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void QuicStreamFactory::OnIdleSession(QuicClientSession* session) { | 424 void QuicStreamFactory::OnIdleSession(QuicClientSession* session) { |
| 425 } | 425 } |
| 426 | 426 |
| 427 void QuicStreamFactory::OnSessionGoingAway(QuicClientSession* session) { | 427 void QuicStreamFactory::OnSessionGoingAway(QuicClientSession* session) { |
| 428 const QuicConnectionStats& stats = session->connection()->GetStats(); |
| 428 const AliasSet& aliases = session_aliases_[session]; | 429 const AliasSet& aliases = session_aliases_[session]; |
| 429 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); | 430 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); |
| 430 ++it) { | 431 ++it) { |
| 431 DCHECK(active_sessions_.count(*it)); | 432 DCHECK(active_sessions_.count(*it)); |
| 432 DCHECK_EQ(session, active_sessions_[*it]); | 433 DCHECK_EQ(session, active_sessions_[*it]); |
| 433 // Track sessions which have recently gone away so that we can disable | 434 // Track sessions which have recently gone away so that we can disable |
| 434 // port suggestions. | 435 // port suggestions. |
| 435 if (session->goaway_received()) { | 436 if (session->goaway_received()) { |
| 436 gone_away_aliases_.insert(*it); | 437 gone_away_aliases_.insert(*it); |
| 437 } | 438 } |
| 438 | 439 |
| 439 active_sessions_.erase(*it); | 440 active_sessions_.erase(*it); |
| 440 if (!http_server_properties_) | 441 if (!http_server_properties_) |
| 441 continue; | 442 continue; |
| 442 | 443 |
| 443 if (!session->IsCryptoHandshakeConfirmed()) { | 444 if (!session->IsCryptoHandshakeConfirmed()) { |
| 444 // TODO(rch): In the special case where the session has received no | 445 // TODO(rch): In the special case where the session has received no |
| 445 // packets from the peer, we should consider blacklisting this | 446 // packets from the peer, we should consider blacklisting this |
| 446 // differently so that we still race TCP but we don't consider the | 447 // differently so that we still race TCP but we don't consider the |
| 447 // session connected until the handshake has been confirmed. | 448 // session connected until the handshake has been confirmed. |
| 448 http_server_properties_->SetBrokenAlternateProtocol(it->first); | 449 http_server_properties_->SetBrokenAlternateProtocol(it->first); |
| 449 } else { | 450 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", |
| 450 QuicConnectionStats stats = session->connection()->GetStats(); | 451 stats.packets_received); |
| 451 HttpServerProperties::NetworkStats network_stats; | 452 continue; |
| 452 network_stats.rtt = base::TimeDelta::FromMicroseconds(stats.rtt); | |
| 453 network_stats.bandwidth_estimate = stats.estimated_bandwidth; | |
| 454 http_server_properties_->SetServerNetworkStats( | |
| 455 it->first, network_stats); | |
| 456 } | 453 } |
| 454 |
| 455 HttpServerProperties::NetworkStats network_stats; |
| 456 network_stats.rtt = base::TimeDelta::FromMicroseconds(stats.rtt); |
| 457 network_stats.bandwidth_estimate = stats.estimated_bandwidth; |
| 458 http_server_properties_->SetServerNetworkStats( |
| 459 it->first, network_stats); |
| 457 } | 460 } |
| 458 IPEndPoint peer_address = session->connection()->peer_address(); | 461 IPEndPoint peer_address = session->connection()->peer_address(); |
| 459 ip_aliases_[peer_address].erase(session); | 462 ip_aliases_[peer_address].erase(session); |
| 460 if (ip_aliases_[peer_address].empty()) { | 463 if (ip_aliases_[peer_address].empty()) { |
| 461 ip_aliases_.erase(peer_address); | 464 ip_aliases_.erase(peer_address); |
| 462 } | 465 } |
| 463 session_aliases_.erase(session); | 466 session_aliases_.erase(session); |
| 464 } | 467 } |
| 465 | 468 |
| 466 void QuicStreamFactory::OnSessionClosed(QuicClientSession* session) { | 469 void QuicStreamFactory::OnSessionClosed(QuicClientSession* session) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 // Copy the CachedState for the canonical server from canonical_crypto_config | 704 // Copy the CachedState for the canonical server from canonical_crypto_config |
| 702 // as the initial CachedState for the server_hostname in crypto_config. | 705 // as the initial CachedState for the server_hostname in crypto_config. |
| 703 crypto_config->InitializeFrom(server_hostname, | 706 crypto_config->InitializeFrom(server_hostname, |
| 704 canonical_host_port_proxy_pair.first.host(), | 707 canonical_host_port_proxy_pair.first.host(), |
| 705 canonical_crypto_config); | 708 canonical_crypto_config); |
| 706 // Update canonical version to point at the "most recent" crypto_config. | 709 // Update canonical version to point at the "most recent" crypto_config. |
| 707 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 710 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
| 708 } | 711 } |
| 709 | 712 |
| 710 } // namespace net | 713 } // namespace net |
| OLD | NEW |