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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1359 } |
1360 | 1360 |
1361 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { | 1361 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { |
1362 DCHECK_EQ(0u, session->GetNumActiveStreams()); | 1362 DCHECK_EQ(0u, session->GetNumActiveStreams()); |
1363 MaybeDisableQuic(session); | 1363 MaybeDisableQuic(session); |
1364 OnSessionGoingAway(session); | 1364 OnSessionGoingAway(session); |
1365 delete session; | 1365 delete session; |
1366 all_sessions_.erase(session); | 1366 all_sessions_.erase(session); |
1367 } | 1367 } |
1368 | 1368 |
1369 void QuicStreamFactory::OnSessionConnectTimeout( | |
1370 QuicChromiumClientSession* session) { | |
1371 const AliasSet& aliases = session_aliases_[session]; | |
1372 | |
1373 if (aliases.empty()) | |
1374 return; | |
1375 | |
1376 for (const QuicSessionKey& key : aliases) { | |
1377 const QuicServerId& server_id = key.server_id(); | |
1378 SessionMap::iterator session_it = active_sessions_.find(server_id); | |
1379 DCHECK(session_it != active_sessions_.end()); | |
1380 DCHECK_EQ(session, session_it->second); | |
1381 active_sessions_.erase(session_it); | |
1382 } | |
1383 | |
1384 const IPEndPoint peer_address = session->connection()->peer_address(); | |
1385 ip_aliases_[peer_address].erase(session); | |
1386 if (ip_aliases_[peer_address].empty()) | |
1387 ip_aliases_.erase(peer_address); | |
1388 QuicSessionKey key = *aliases.begin(); | |
1389 session_aliases_.erase(session); | |
1390 Job* job = new Job(this, host_resolver_, session, key); | |
1391 active_jobs_[key.server_id()].insert(job); | |
1392 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, | |
1393 base::Unretained(this), job)); | |
1394 DCHECK_EQ(ERR_IO_PENDING, rv); | |
1395 } | |
1396 | |
1397 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { | 1369 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { |
1398 RequestMap::iterator request_it = active_requests_.find(request); | 1370 RequestMap::iterator request_it = active_requests_.find(request); |
1399 DCHECK(request_it != active_requests_.end()); | 1371 DCHECK(request_it != active_requests_.end()); |
1400 const QuicServerId& server_id = request_it->second; | 1372 const QuicServerId& server_id = request_it->second; |
1401 job_requests_map_[server_id].erase(request); | 1373 job_requests_map_[server_id].erase(request); |
1402 active_requests_.erase(request_it); | 1374 active_requests_.erase(request_it); |
1403 } | 1375 } |
1404 | 1376 |
1405 void QuicStreamFactory::CloseAllSessions(int error, QuicErrorCode quic_error) { | 1377 void QuicStreamFactory::CloseAllSessions(int error, QuicErrorCode quic_error) { |
1406 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseAllSessionsError", -error); | 1378 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseAllSessionsError", -error); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 // Since the session was active, there's no longer an | 2014 // Since the session was active, there's no longer an |
2043 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2015 // 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 | 2016 // 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 | 2017 // it as recently broken, which means that 0-RTT will be disabled but we'll |
2046 // still race. | 2018 // still race. |
2047 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2019 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
2048 alternative_service); | 2020 alternative_service); |
2049 } | 2021 } |
2050 | 2022 |
2051 } // namespace net | 2023 } // namespace net |
OLD | NEW |