| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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/quartc/quartc_factory.h" | 5 #include "net/quic/quartc/quartc_factory.h" |
| 6 | 6 |
| 7 #include "net/quic/core/crypto/quic_random.h" | 7 #include "net/quic/core/crypto/quic_random.h" |
| 8 #include "net/quic/platform/api/quic_socket_address.h" | 8 #include "net/quic/platform/api/quic_socket_address.h" |
| 9 #include "net/quic/quartc/quartc_session.h" | 9 #include "net/quic/quartc/quartc_session.h" |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 std::unique_ptr<QuartcSessionInterface> QuartcFactory::CreateQuartcSession( | 106 std::unique_ptr<QuartcSessionInterface> QuartcFactory::CreateQuartcSession( |
| 107 const QuartcSessionConfig& quartc_session_config) { | 107 const QuartcSessionConfig& quartc_session_config) { |
| 108 DCHECK(quartc_session_config.packet_transport); | 108 DCHECK(quartc_session_config.packet_transport); |
| 109 | 109 |
| 110 Perspective perspective = quartc_session_config.is_server | 110 Perspective perspective = quartc_session_config.is_server |
| 111 ? Perspective::IS_SERVER | 111 ? Perspective::IS_SERVER |
| 112 : Perspective::IS_CLIENT; | 112 : Perspective::IS_CLIENT; |
| 113 std::unique_ptr<QuicConnection> quic_connection = | 113 std::unique_ptr<QuicConnection> quic_connection = |
| 114 CreateQuicConnection(quartc_session_config, perspective); | 114 CreateQuicConnection(quartc_session_config, perspective); |
| 115 QuicTagVector copt; |
| 116 if (quartc_session_config.congestion_control == |
| 117 QuartcCongestionControl::kBBR) { |
| 118 copt.push_back(kTBBR); |
| 119 } |
| 115 QuicConfig quic_config; | 120 QuicConfig quic_config; |
| 121 quic_config.SetConnectionOptionsToSend(copt); |
| 122 quic_config.SetClientConnectionOptions(copt); |
| 116 return std::unique_ptr<QuartcSessionInterface>(new QuartcSession( | 123 return std::unique_ptr<QuartcSessionInterface>(new QuartcSession( |
| 117 std::move(quic_connection), quic_config, | 124 std::move(quic_connection), quic_config, |
| 118 quartc_session_config.unique_remote_server_id, perspective, | 125 quartc_session_config.unique_remote_server_id, perspective, |
| 119 this /*QuicConnectionHelperInterface*/, clock_.get())); | 126 this /*QuicConnectionHelperInterface*/, clock_.get())); |
| 120 } | 127 } |
| 121 | 128 |
| 122 std::unique_ptr<QuicConnection> QuartcFactory::CreateQuicConnection( | 129 std::unique_ptr<QuicConnection> QuartcFactory::CreateQuicConnection( |
| 123 const QuartcSessionConfig& quartc_session_config, | 130 const QuartcSessionConfig& quartc_session_config, |
| 124 Perspective perspective) { | 131 Perspective perspective) { |
| 125 // The QuicConnection will take the ownership. | 132 // The QuicConnection will take the ownership. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return &buffer_allocator_; | 167 return &buffer_allocator_; |
| 161 } | 168 } |
| 162 | 169 |
| 163 std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( | 170 std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( |
| 164 const QuartcFactoryConfig& factory_config) { | 171 const QuartcFactoryConfig& factory_config) { |
| 165 return std::unique_ptr<QuartcFactoryInterface>( | 172 return std::unique_ptr<QuartcFactoryInterface>( |
| 166 new QuartcFactory(factory_config)); | 173 new QuartcFactory(factory_config)); |
| 167 } | 174 } |
| 168 | 175 |
| 169 } // namespace net | 176 } // namespace net |
| OLD | NEW |