OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_server_session.h" | 5 #include "net/quic/quic_server_session.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/crypto/cached_network_parameters.h" | 8 #include "net/quic/crypto/cached_network_parameters.h" |
9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); | 30 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); |
31 } | 31 } |
32 | 32 |
33 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( | 33 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( |
34 const QuicCryptoServerConfig& crypto_config) { | 34 const QuicCryptoServerConfig& crypto_config) { |
35 return new QuicCryptoServerStream(crypto_config, this); | 35 return new QuicCryptoServerStream(crypto_config, this); |
36 } | 36 } |
37 | 37 |
38 void QuicServerSession::OnConfigNegotiated() { | 38 void QuicServerSession::OnConfigNegotiated() { |
39 QuicSession::OnConfigNegotiated(); | 39 QuicSession::OnConfigNegotiated(); |
40 if (!FLAGS_enable_quic_fec || | 40 |
41 !config()->HasReceivedConnectionOptions() || | 41 if (!config()->HasReceivedConnectionOptions()) { |
42 !ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) { | |
43 return; | 42 return; |
44 } | 43 } |
45 // kFHDR config maps to FEC protection always for headers stream. | 44 |
46 // TODO(jri): Add crypto stream in addition to headers for kHDR. | 45 // If the client has provided a bandwidth estimate from the same serving |
47 headers_stream_->set_fec_policy(FEC_PROTECT_ALWAYS); | 46 // region, then pass it to the sent packet manager in preparation for possible |
| 47 // bandwidth resumption. |
| 48 const CachedNetworkParameters* cached_network_params = |
| 49 crypto_stream_->previous_cached_network_params(); |
| 50 if (FLAGS_quic_enable_bandwidth_resumption_experiment && |
| 51 cached_network_params != nullptr && |
| 52 ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWRE) && |
| 53 cached_network_params->serving_region() == serving_region_) { |
| 54 connection()->ResumeConnectionState(*cached_network_params); |
| 55 } |
| 56 |
| 57 if (FLAGS_enable_quic_fec && |
| 58 ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) { |
| 59 // kFHDR config maps to FEC protection always for headers stream. |
| 60 // TODO(jri): Add crypto stream in addition to headers for kHDR. |
| 61 headers_stream_->set_fec_policy(FEC_PROTECT_ALWAYS); |
| 62 } |
48 } | 63 } |
49 | 64 |
50 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, | 65 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, |
51 bool from_peer) { | 66 bool from_peer) { |
52 QuicSession::OnConnectionClosed(error, from_peer); | 67 QuicSession::OnConnectionClosed(error, from_peer); |
53 // In the unlikely event we get a connection close while doing an asynchronous | 68 // In the unlikely event we get a connection close while doing an asynchronous |
54 // crypto event, make sure we cancel the callback. | 69 // crypto event, make sure we cancel the callback. |
55 if (crypto_stream_.get() != nullptr) { | 70 if (crypto_stream_.get() != nullptr) { |
56 crypto_stream_->CancelOutstandingCallbacks(); | 71 crypto_stream_->CancelOutstandingCallbacks(); |
57 } | 72 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { | 187 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { |
173 DLOG(ERROR) << "Server push not yet supported"; | 188 DLOG(ERROR) << "Server push not yet supported"; |
174 return nullptr; | 189 return nullptr; |
175 } | 190 } |
176 | 191 |
177 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 192 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
178 return crypto_stream_.get(); | 193 return crypto_stream_.get(); |
179 } | 194 } |
180 | 195 |
181 } // namespace net | 196 } // namespace net |
OLD | NEW |