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/quic/core/quic_server_session_base.h" | 5 #include "net/quic/core/quic_server_session_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 8 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
9 #include "net/quic/core/quic_bug_tracker.h" | 9 #include "net/quic/core/quic_bug_tracker.h" |
10 #include "net/quic/core/quic_connection.h" | 10 #include "net/quic/core/quic_connection.h" |
11 #include "net/quic/core/quic_flags.h" | 11 #include "net/quic/core/quic_flags.h" |
12 #include "net/quic/core/quic_spdy_session.h" | 12 #include "net/quic/core/quic_spdy_session.h" |
13 #include "net/quic/core/reliable_quic_stream.h" | 13 #include "net/quic/core/reliable_quic_stream.h" |
14 | 14 |
15 using std::string; | 15 using std::string; |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 QuicServerSessionBase::QuicServerSessionBase( | 19 QuicServerSessionBase::QuicServerSessionBase( |
20 const QuicConfig& config, | 20 const QuicConfig& config, |
21 QuicConnection* connection, | 21 QuicConnection* connection, |
22 Visitor* visitor, | 22 Visitor* visitor, |
23 Helper* helper, | 23 QuicCryptoServerStream::Helper* helper, |
24 const QuicCryptoServerConfig* crypto_config, | 24 const QuicCryptoServerConfig* crypto_config, |
25 QuicCompressedCertsCache* compressed_certs_cache) | 25 QuicCompressedCertsCache* compressed_certs_cache) |
26 : QuicSpdySession(connection, config), | 26 : QuicSpdySession(connection, config), |
27 crypto_config_(crypto_config), | 27 crypto_config_(crypto_config), |
28 compressed_certs_cache_(compressed_certs_cache), | 28 compressed_certs_cache_(compressed_certs_cache), |
29 visitor_(visitor), | 29 visitor_(visitor), |
30 helper_(helper), | 30 helper_(helper), |
31 bandwidth_resumption_enabled_(false), | 31 bandwidth_resumption_enabled_(false), |
32 bandwidth_estimate_sent_to_client_(QuicBandwidth::Zero()), | 32 bandwidth_estimate_sent_to_client_(QuicBandwidth::Zero()), |
33 last_scup_time_(QuicTime::Zero()), | 33 last_scup_time_(QuicTime::Zero()), |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 | 192 |
193 crypto_stream_->SendServerConfigUpdate(&cached_network_params); | 193 crypto_stream_->SendServerConfigUpdate(&cached_network_params); |
194 | 194 |
195 connection()->OnSendConnectionState(cached_network_params); | 195 connection()->OnSendConnectionState(cached_network_params); |
196 | 196 |
197 last_scup_time_ = now; | 197 last_scup_time_ = now; |
198 last_scup_packet_number_ = connection()->packet_number_of_last_sent_packet(); | 198 last_scup_packet_number_ = connection()->packet_number_of_last_sent_packet(); |
199 } | 199 } |
200 | 200 |
201 QuicConnectionId QuicServerSessionBase::GenerateConnectionIdForReject( | |
202 QuicConnectionId connection_id) { | |
203 return helper_->GenerateConnectionIdForReject(connection_id); | |
204 } | |
205 | |
206 bool QuicServerSessionBase::CanAcceptClientHello( | |
207 const CryptoHandshakeMessage& message, | |
208 string* error_details) { | |
209 return helper_->CanAcceptClientHello(message, connection()->self_address(), | |
210 error_details); | |
211 } | |
212 | |
213 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) { | 201 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) { |
214 if (!connection()->connected()) { | 202 if (!connection()->connected()) { |
215 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; | 203 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; |
216 return false; | 204 return false; |
217 } | 205 } |
218 | 206 |
219 if (id % 2 == 0) { | 207 if (id % 2 == 0) { |
220 DVLOG(1) << "Invalid incoming even stream_id:" << id; | 208 DVLOG(1) << "Invalid incoming even stream_id:" << id; |
221 connection()->CloseConnection( | 209 connection()->CloseConnection( |
222 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", | 210 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", |
(...skipping 26 matching lines...) Expand all Loading... |
249 | 237 |
250 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( | 238 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( |
251 const QuicBandwidth& bandwidth) { | 239 const QuicBandwidth& bandwidth) { |
252 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); | 240 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); |
253 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) | 241 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) |
254 ? INT32_MAX | 242 ? INT32_MAX |
255 : static_cast<int32_t>(bytes_per_second)); | 243 : static_cast<int32_t>(bytes_per_second)); |
256 } | 244 } |
257 | 245 |
258 } // namespace net | 246 } // namespace net |
OLD | NEW |