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