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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include <openssl/aead.h> | 10 #include <openssl/aead.h> |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "net/dns/host_resolver.h" | 33 #include "net/dns/host_resolver.h" |
34 #include "net/dns/single_request_host_resolver.h" | 34 #include "net/dns/single_request_host_resolver.h" |
35 #include "net/http/bidirectional_stream_impl.h" | 35 #include "net/http/bidirectional_stream_impl.h" |
36 #include "net/quic/bidirectional_stream_quic_impl.h" | 36 #include "net/quic/bidirectional_stream_quic_impl.h" |
37 #include "net/quic/crypto/channel_id_chromium.h" | 37 #include "net/quic/crypto/channel_id_chromium.h" |
38 #include "net/quic/crypto/proof_verifier_chromium.h" | 38 #include "net/quic/crypto/proof_verifier_chromium.h" |
39 #include "net/quic/crypto/properties_based_quic_server_info.h" | 39 #include "net/quic/crypto/properties_based_quic_server_info.h" |
40 #include "net/quic/crypto/quic_random.h" | 40 #include "net/quic/crypto/quic_random.h" |
41 #include "net/quic/crypto/quic_server_info.h" | 41 #include "net/quic/crypto/quic_server_info.h" |
42 #include "net/quic/port_suggester.h" | 42 #include "net/quic/port_suggester.h" |
| 43 #include "net/quic/quic_chromium_alarm_factory.h" |
43 #include "net/quic/quic_chromium_client_session.h" | 44 #include "net/quic/quic_chromium_client_session.h" |
44 #include "net/quic/quic_chromium_connection_helper.h" | 45 #include "net/quic/quic_chromium_connection_helper.h" |
45 #include "net/quic/quic_chromium_packet_reader.h" | 46 #include "net/quic/quic_chromium_packet_reader.h" |
46 #include "net/quic/quic_chromium_packet_writer.h" | 47 #include "net/quic/quic_chromium_packet_writer.h" |
47 #include "net/quic/quic_client_promised_info.h" | 48 #include "net/quic/quic_client_promised_info.h" |
48 #include "net/quic/quic_clock.h" | 49 #include "net/quic/quic_clock.h" |
49 #include "net/quic/quic_connection.h" | 50 #include "net/quic/quic_connection.h" |
50 #include "net/quic/quic_crypto_client_stream_factory.h" | 51 #include "net/quic/quic_crypto_client_stream_factory.h" |
51 #include "net/quic/quic_flags.h" | 52 #include "net/quic/quic_flags.h" |
52 #include "net/quic/quic_http_stream.h" | 53 #include "net/quic/quic_http_stream.h" |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", | 1541 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", |
1541 port_suggester->call_count()); | 1542 port_suggester->call_count()); |
1542 if (enable_port_selection) { | 1543 if (enable_port_selection) { |
1543 DCHECK_LE(1u, port_suggester->call_count()); | 1544 DCHECK_LE(1u, port_suggester->call_count()); |
1544 } else { | 1545 } else { |
1545 DCHECK_EQ(0u, port_suggester->call_count()); | 1546 DCHECK_EQ(0u, port_suggester->call_count()); |
1546 } | 1547 } |
1547 | 1548 |
1548 if (!helper_.get()) { | 1549 if (!helper_.get()) { |
1549 helper_.reset(new QuicChromiumConnectionHelper( | 1550 helper_.reset(new QuicChromiumConnectionHelper( |
1550 base::ThreadTaskRunnerHandle::Get().get(), clock_.get(), | 1551 clock_.get(), random_generator_)); |
1551 random_generator_)); | 1552 } |
| 1553 |
| 1554 if (!alarm_factory_.get()) { |
| 1555 alarm_factory_.reset(new QuicChromiumAlarmFactory( |
| 1556 base::ThreadTaskRunnerHandle::Get().get(), clock_.get())); |
1552 } | 1557 } |
1553 QuicConnectionId connection_id = random_generator_->RandUint64(); | 1558 QuicConnectionId connection_id = random_generator_->RandUint64(); |
1554 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); | 1559 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); |
1555 | 1560 |
1556 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); | 1561 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); |
1557 QuicConnection* connection = new QuicConnection( | 1562 QuicConnection* connection = new QuicConnection( |
1558 connection_id, addr, helper_.get(), writer, true /* owns_writer */, | 1563 connection_id, addr, helper_.get(), alarm_factory_.get(), writer, true /*
owns_writer */, |
1559 Perspective::IS_CLIENT, supported_versions_); | 1564 Perspective::IS_CLIENT, supported_versions_); |
1560 writer->SetConnection(connection); | 1565 writer->SetConnection(connection); |
1561 connection->SetMaxPacketLength(max_packet_length_); | 1566 connection->SetMaxPacketLength(max_packet_length_); |
1562 | 1567 |
1563 QuicConfig config = config_; | 1568 QuicConfig config = config_; |
1564 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); | 1569 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); |
1565 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); | 1570 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
1566 config.SetInitialSessionFlowControlWindowToSend( | 1571 config.SetInitialSessionFlowControlWindowToSend( |
1567 kQuicSessionMaxRecvWindowSize); | 1572 kQuicSessionMaxRecvWindowSize); |
1568 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); | 1573 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 // Since the session was active, there's no longer an | 1765 // Since the session was active, there's no longer an |
1761 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1766 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1762 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1767 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1763 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1768 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1764 // still race. | 1769 // still race. |
1765 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1770 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1766 alternative_service); | 1771 alternative_service); |
1767 } | 1772 } |
1768 | 1773 |
1769 } // namespace net | 1774 } // namespace net |
OLD | NEW |