| 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_base.h" | 5 #include "net/tools/quic/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/proto/cached_network_parameters.pb.h" | 8 #include "net/quic/proto/cached_network_parameters.pb.h" |
| 9 #include "net/quic/quic_bug_tracker.h" | 9 #include "net/quic/quic_bug_tracker.h" |
| 10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Only do bandwidth resumption if estimate is recent enough. | 64 // Only do bandwidth resumption if estimate is recent enough. |
| 65 const int64_t seconds_since_estimate = | 65 const int64_t seconds_since_estimate = |
| 66 connection()->clock()->WallNow().ToUNIXSeconds() - | 66 connection()->clock()->WallNow().ToUNIXSeconds() - |
| 67 cached_network_params->timestamp(); | 67 cached_network_params->timestamp(); |
| 68 if (seconds_since_estimate <= kNumSecondsPerHour) { | 68 if (seconds_since_estimate <= kNumSecondsPerHour) { |
| 69 connection()->ResumeConnectionState(*cached_network_params, | 69 connection()->ResumeConnectionState(*cached_network_params, |
| 70 max_bandwidth_resumption); | 70 max_bandwidth_resumption); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | |
| 75 if (FLAGS_enable_quic_fec && | |
| 76 ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) { | |
| 77 // kFHDR config maps to FEC protection always for headers stream. | |
| 78 // TODO(jri): Add crypto stream in addition to headers for kHDR. | |
| 79 headers_stream()->set_fec_policy(FEC_PROTECT_ALWAYS); | |
| 80 } | |
| 81 } | 74 } |
| 82 | 75 |
| 83 void QuicServerSessionBase::OnConnectionClosed(QuicErrorCode error, | 76 void QuicServerSessionBase::OnConnectionClosed(QuicErrorCode error, |
| 84 ConnectionCloseSource source) { | 77 ConnectionCloseSource source) { |
| 85 QuicSession::OnConnectionClosed(error, source); | 78 QuicSession::OnConnectionClosed(error, source); |
| 86 // In the unlikely event we get a connection close while doing an asynchronous | 79 // In the unlikely event we get a connection close while doing an asynchronous |
| 87 // crypto event, make sure we cancel the callback. | 80 // crypto event, make sure we cancel the callback. |
| 88 if (crypto_stream_.get() != nullptr) { | 81 if (crypto_stream_.get() != nullptr) { |
| 89 crypto_stream_->CancelOutstandingCallbacks(); | 82 crypto_stream_->CancelOutstandingCallbacks(); |
| 90 } | 83 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return false; | 206 return false; |
| 214 } | 207 } |
| 215 return true; | 208 return true; |
| 216 } | 209 } |
| 217 | 210 |
| 218 QuicCryptoServerStreamBase* QuicServerSessionBase::GetCryptoStream() { | 211 QuicCryptoServerStreamBase* QuicServerSessionBase::GetCryptoStream() { |
| 219 return crypto_stream_.get(); | 212 return crypto_stream_.get(); |
| 220 } | 213 } |
| 221 | 214 |
| 222 } // namespace net | 215 } // namespace net |
| OLD | NEW |