| 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/proto/cached_network_parameters.pb.h" | 8 #include "net/quic/proto/cached_network_parameters.pb.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 17 matching lines...) Expand all Loading... |
| 28 last_scup_time_(QuicTime::Zero()), | 28 last_scup_time_(QuicTime::Zero()), |
| 29 last_scup_packet_number_(0) {} | 29 last_scup_packet_number_(0) {} |
| 30 | 30 |
| 31 QuicServerSession::~QuicServerSession() {} | 31 QuicServerSession::~QuicServerSession() {} |
| 32 | 32 |
| 33 void QuicServerSession::Initialize() { | 33 void QuicServerSession::Initialize() { |
| 34 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config_)); | 34 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config_)); |
| 35 QuicSpdySession::Initialize(); | 35 QuicSpdySession::Initialize(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( | 38 QuicCryptoServerStreamBase* QuicServerSession::CreateQuicCryptoServerStream( |
| 39 const QuicCryptoServerConfig* crypto_config) { | 39 const QuicCryptoServerConfig* crypto_config) { |
| 40 return new QuicCryptoServerStream(crypto_config, this); | 40 return new QuicCryptoServerStream(crypto_config, this); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void QuicServerSession::OnConfigNegotiated() { | 43 void QuicServerSession::OnConfigNegotiated() { |
| 44 QuicSession::OnConfigNegotiated(); | 44 QuicSession::OnConfigNegotiated(); |
| 45 | 45 |
| 46 if (!config()->HasReceivedConnectionOptions()) { | 46 if (!config()->HasReceivedConnectionOptions()) { |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // If the client has provided a bandwidth estimate from the same serving | 50 // If the client has provided a bandwidth estimate from the same serving |
| 51 // region, then pass it to the sent packet manager in preparation for possible | 51 // region, then pass it to the sent packet manager in preparation for possible |
| 52 // bandwidth resumption. | 52 // bandwidth resumption. |
| 53 const CachedNetworkParameters* cached_network_params = | 53 const CachedNetworkParameters* cached_network_params = |
| 54 crypto_stream_->previous_cached_network_params(); | 54 crypto_stream_->PreviousCachedNetworkParams(); |
| 55 const bool last_bandwidth_resumption = | 55 const bool last_bandwidth_resumption = |
| 56 ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWRE); | 56 ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWRE); |
| 57 const bool max_bandwidth_resumption = | 57 const bool max_bandwidth_resumption = |
| 58 ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWMX); | 58 ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWMX); |
| 59 bandwidth_resumption_enabled_ = | 59 bandwidth_resumption_enabled_ = |
| 60 last_bandwidth_resumption || max_bandwidth_resumption; | 60 last_bandwidth_resumption || max_bandwidth_resumption; |
| 61 if (cached_network_params != nullptr && bandwidth_resumption_enabled_ && | 61 if (cached_network_params != nullptr && bandwidth_resumption_enabled_ && |
| 62 cached_network_params->serving_region() == serving_region_) { | 62 cached_network_params->serving_region() == serving_region_) { |
| 63 int64 seconds_since_estimate = | 63 int64 seconds_since_estimate = |
| 64 connection()->clock()->WallNow().ToUNIXSeconds() - | 64 connection()->clock()->WallNow().ToUNIXSeconds() - |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 return new QuicSpdyServerStream(id, this); | 205 return new QuicSpdyServerStream(id, this); |
| 206 } | 206 } |
| 207 | 207 |
| 208 QuicSpdyStream* QuicServerSession::CreateOutgoingDynamicStream() { | 208 QuicSpdyStream* QuicServerSession::CreateOutgoingDynamicStream() { |
| 209 DLOG(ERROR) << "Server push not yet supported"; | 209 DLOG(ERROR) << "Server push not yet supported"; |
| 210 return nullptr; | 210 return nullptr; |
| 211 } | 211 } |
| 212 | 212 |
| 213 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 213 QuicCryptoServerStreamBase* QuicServerSession::GetCryptoStream() { |
| 214 return crypto_stream_.get(); | 214 return crypto_stream_.get(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace tools | 217 } // namespace tools |
| 218 } // namespace net | 218 } // namespace net |
| OLD | NEW |