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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 session->CloseSessionOnError(ERR_NETWORK_CHANGED, QUIC_INTERNAL_ERROR); | 1630 session->CloseSessionOnError(ERR_NETWORK_CHANGED, QUIC_INTERNAL_ERROR); |
1631 } | 1631 } |
1632 return; | 1632 return; |
1633 } | 1633 } |
1634 std::unique_ptr<QuicChromiumPacketReader> new_reader( | 1634 std::unique_ptr<QuicChromiumPacketReader> new_reader( |
1635 new QuicChromiumPacketReader(socket.get(), clock_.get(), session, | 1635 new QuicChromiumPacketReader(socket.get(), clock_.get(), session, |
1636 yield_after_packets_, yield_after_duration_, | 1636 yield_after_packets_, yield_after_duration_, |
1637 session->net_log())); | 1637 session->net_log())); |
1638 std::unique_ptr<QuicChromiumPacketWriter> new_writer( | 1638 std::unique_ptr<QuicChromiumPacketWriter> new_writer( |
1639 new QuicChromiumPacketWriter(socket.get())); | 1639 new QuicChromiumPacketWriter(socket.get())); |
1640 new_writer->Initialize(session, session->connection()); | 1640 new_writer->set_delegate(session); |
1641 | 1641 |
1642 if (!session->MigrateToSocket(std::move(socket), std::move(new_reader), | 1642 if (!session->MigrateToSocket(std::move(socket), std::move(new_reader), |
1643 std::move(new_writer), packet)) { | 1643 std::move(new_writer), packet)) { |
1644 // TODO(jokulik): It's not clear how we could end up on this code | 1644 // TODO(jokulik): It's not clear how we could end up on this code |
1645 // path. We would theoretically hit this failure if we've | 1645 // path. We would theoretically hit this failure if we've |
1646 // performed too many migrations on this session. However, the | 1646 // performed too many migrations on this session. However, the |
1647 // session will be marked as going away after a previous | 1647 // session will be marked as going away after a previous |
1648 // migration, making subsequent migration impossible. | 1648 // migration, making subsequent migration impossible. |
1649 HistogramAndLogMigrationFailure( | 1649 HistogramAndLogMigrationFailure( |
1650 bound_net_log, MIGRATION_STATUS_TOO_MANY_CHANGES, | 1650 bound_net_log, MIGRATION_STATUS_TOO_MANY_CHANGES, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 *session = new QuicChromiumClientSession( | 1853 *session = new QuicChromiumClientSession( |
1854 connection, std::move(socket), this, quic_crypto_client_stream_factory_, | 1854 connection, std::move(socket), this, quic_crypto_client_stream_factory_, |
1855 clock_.get(), transport_security_state_, std::move(server_info), | 1855 clock_.get(), transport_security_state_, std::move(server_info), |
1856 server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags, | 1856 server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags, |
1857 config, &crypto_config_, network_connection_.GetDescription(), | 1857 config, &crypto_config_, network_connection_.GetDescription(), |
1858 dns_resolution_end_time, &push_promise_index_, | 1858 dns_resolution_end_time, &push_promise_index_, |
1859 base::ThreadTaskRunnerHandle::Get().get(), | 1859 base::ThreadTaskRunnerHandle::Get().get(), |
1860 std::move(socket_performance_watcher), net_log.net_log()); | 1860 std::move(socket_performance_watcher), net_log.net_log()); |
1861 | 1861 |
1862 all_sessions_[*session] = key; // owning pointer | 1862 all_sessions_[*session] = key; // owning pointer |
1863 writer->Initialize(*session, connection); | 1863 writer->set_delegate(*session); |
1864 | 1864 |
1865 (*session)->Initialize(); | 1865 (*session)->Initialize(); |
1866 bool closed_during_initialize = !base::ContainsKey(all_sessions_, *session) || | 1866 bool closed_during_initialize = !base::ContainsKey(all_sessions_, *session) || |
1867 !(*session)->connection()->connected(); | 1867 !(*session)->connection()->connected(); |
1868 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", | 1868 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", |
1869 closed_during_initialize); | 1869 closed_during_initialize); |
1870 if (closed_during_initialize) { | 1870 if (closed_during_initialize) { |
1871 DLOG(DFATAL) << "Session closed during initialize"; | 1871 DLOG(DFATAL) << "Session closed during initialize"; |
1872 *session = nullptr; | 1872 *session = nullptr; |
1873 return ERR_CONNECTION_CLOSED; | 1873 return ERR_CONNECTION_CLOSED; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2053 // Since the session was active, there's no longer an | 2053 // Since the session was active, there's no longer an |
2054 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2054 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
2055 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2055 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
2056 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2056 // it as recently broken, which means that 0-RTT will be disabled but we'll |
2057 // still race. | 2057 // still race. |
2058 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2058 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
2059 alternative_service); | 2059 alternative_service); |
2060 } | 2060 } |
2061 | 2061 |
2062 } // namespace net | 2062 } // namespace net |
OLD | NEW |