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 <openssl/aead.h> | 7 #include <openssl/aead.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 // Track sessions which have recently gone away so that we can disable | 1255 // Track sessions which have recently gone away so that we can disable |
1256 // port suggestions. | 1256 // port suggestions. |
1257 if (session->goaway_received()) | 1257 if (session->goaway_received()) |
1258 gone_away_aliases_.insert(*it); | 1258 gone_away_aliases_.insert(*it); |
1259 | 1259 |
1260 active_sessions_.erase(server_id); | 1260 active_sessions_.erase(server_id); |
1261 ProcessGoingAwaySession(session, server_id, true); | 1261 ProcessGoingAwaySession(session, server_id, true); |
1262 } | 1262 } |
1263 ProcessGoingAwaySession(session, all_sessions_[session].server_id(), false); | 1263 ProcessGoingAwaySession(session, all_sessions_[session].server_id(), false); |
1264 if (!aliases.empty()) { | 1264 if (!aliases.empty()) { |
1265 const IPEndPoint peer_address = session->connection()->peer_address(); | 1265 DCHECK(base::ContainsKey(session_peer_ip_, session)); |
| 1266 const IPEndPoint peer_address = session_peer_ip_[session]; |
1266 ip_aliases_[peer_address].erase(session); | 1267 ip_aliases_[peer_address].erase(session); |
1267 if (ip_aliases_[peer_address].empty()) | 1268 if (ip_aliases_[peer_address].empty()) |
1268 ip_aliases_.erase(peer_address); | 1269 ip_aliases_.erase(peer_address); |
| 1270 session_peer_ip_.erase(session); |
1269 } | 1271 } |
1270 session_aliases_.erase(session); | 1272 session_aliases_.erase(session); |
1271 } | 1273 } |
1272 | 1274 |
1273 void QuicStreamFactory::MaybeDisableQuic(QuicChromiumClientSession* session) { | 1275 void QuicStreamFactory::MaybeDisableQuic(QuicChromiumClientSession* session) { |
1274 DCHECK(session); | 1276 DCHECK(session); |
1275 uint16_t port = session->server_id().port(); | 1277 uint16_t port = session->server_id().port(); |
1276 if (IsQuicDisabled(port)) | 1278 if (IsQuicDisabled(port)) |
1277 return; | 1279 return; |
1278 | 1280 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 void QuicStreamFactory::ActivateSession(const QuicSessionKey& key, | 1872 void QuicStreamFactory::ActivateSession(const QuicSessionKey& key, |
1871 QuicChromiumClientSession* session) { | 1873 QuicChromiumClientSession* session) { |
1872 const QuicServerId& server_id(key.server_id()); | 1874 const QuicServerId& server_id(key.server_id()); |
1873 DCHECK(!HasActiveSession(server_id)); | 1875 DCHECK(!HasActiveSession(server_id)); |
1874 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); | 1876 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); |
1875 active_sessions_[server_id] = session; | 1877 active_sessions_[server_id] = session; |
1876 session_aliases_[session].insert(key); | 1878 session_aliases_[session].insert(key); |
1877 const IPEndPoint peer_address = session->connection()->peer_address(); | 1879 const IPEndPoint peer_address = session->connection()->peer_address(); |
1878 DCHECK(!base::ContainsKey(ip_aliases_[peer_address], session)); | 1880 DCHECK(!base::ContainsKey(ip_aliases_[peer_address], session)); |
1879 ip_aliases_[peer_address].insert(session); | 1881 ip_aliases_[peer_address].insert(session); |
| 1882 DCHECK(!base::ContainsKey(session_peer_ip_, session)); |
| 1883 session_peer_ip_[session] = peer_address; |
1880 } | 1884 } |
1881 | 1885 |
1882 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds( | 1886 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds( |
1883 const QuicServerId& server_id) const { | 1887 const QuicServerId& server_id) const { |
1884 url::SchemeHostPort server("https", server_id.host_port_pair().host(), | 1888 url::SchemeHostPort server("https", server_id.host_port_pair().host(), |
1885 server_id.host_port_pair().port()); | 1889 server_id.host_port_pair().port()); |
1886 const ServerNetworkStats* stats = | 1890 const ServerNetworkStats* stats = |
1887 http_server_properties_->GetServerNetworkStats(server); | 1891 http_server_properties_->GetServerNetworkStats(server); |
1888 if (stats == nullptr) | 1892 if (stats == nullptr) |
1889 return 0; | 1893 return 0; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 // Since the session was active, there's no longer an | 2046 // Since the session was active, there's no longer an |
2043 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2047 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
2044 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2048 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
2045 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2049 // it as recently broken, which means that 0-RTT will be disabled but we'll |
2046 // still race. | 2050 // still race. |
2047 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2051 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
2048 alternative_service); | 2052 alternative_service); |
2049 } | 2053 } |
2050 | 2054 |
2051 } // namespace net | 2055 } // namespace net |
OLD | NEW |