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 "net/quic/core/proto/cached_network_parameters.pb.h" | 7 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
8 #include "net/quic/core/quic_connection.h" | 8 #include "net/quic/core/quic_connection.h" |
9 #include "net/quic/core/quic_stream.h" | 9 #include "net/quic/core/quic_stream.h" |
10 #include "net/quic/platform/api/quic_bug_tracker.h" | 10 #include "net/quic/platform/api/quic_bug_tracker.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 crypto_stream_->SendServerConfigUpdate(&cached_network_params); | 188 crypto_stream_->SendServerConfigUpdate(&cached_network_params); |
189 | 189 |
190 connection()->OnSendConnectionState(cached_network_params); | 190 connection()->OnSendConnectionState(cached_network_params); |
191 | 191 |
192 last_scup_time_ = now; | 192 last_scup_time_ = now; |
193 last_scup_packet_number_ = | 193 last_scup_packet_number_ = |
194 connection()->sent_packet_manager().GetLargestSentPacket(); | 194 connection()->sent_packet_manager().GetLargestSentPacket(); |
195 } | 195 } |
196 | 196 |
197 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) { | 197 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) { |
| 198 DCHECK(!FLAGS_quic_reloadable_flag_quic_refactor_stream_creation); |
198 if (!connection()->connected()) { | 199 if (!connection()->connected()) { |
199 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; | 200 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; |
200 return false; | 201 return false; |
201 } | 202 } |
202 | 203 |
203 if (id % 2 == 0) { | 204 if (id % 2 == 0) { |
204 QUIC_DLOG(INFO) << "Invalid incoming even stream_id:" << id; | 205 QUIC_DLOG(INFO) << "Invalid incoming even stream_id:" << id; |
205 connection()->CloseConnection( | 206 connection()->CloseConnection( |
206 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", | 207 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", |
207 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 208 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
208 return false; | 209 return false; |
209 } | 210 } |
210 return true; | 211 return true; |
211 } | 212 } |
212 | 213 |
213 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() { | 214 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() { |
| 215 DCHECK(!FLAGS_quic_reloadable_flag_quic_refactor_stream_creation); |
214 if (!connection()->connected()) { | 216 if (!connection()->connected()) { |
215 QUIC_BUG << "ShouldCreateOutgoingDynamicStream called when disconnected"; | 217 QUIC_BUG << "ShouldCreateOutgoingDynamicStream called when disconnected"; |
216 return false; | 218 return false; |
217 } | 219 } |
218 if (!crypto_stream_->encryption_established()) { | 220 if (!crypto_stream_->encryption_established()) { |
219 QUIC_BUG << "Encryption not established so no outgoing stream created."; | 221 QUIC_BUG << "Encryption not established so no outgoing stream created."; |
220 return false; | 222 return false; |
221 } | 223 } |
222 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { | 224 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { |
223 VLOG(1) << "No more streams should be created. " | 225 VLOG(1) << "No more streams should be created. " |
(...skipping 14 matching lines...) Expand all Loading... |
238 | 240 |
239 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( | 241 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( |
240 const QuicBandwidth& bandwidth) { | 242 const QuicBandwidth& bandwidth) { |
241 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); | 243 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); |
242 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) | 244 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) |
243 ? INT32_MAX | 245 ? INT32_MAX |
244 : static_cast<int32_t>(bytes_per_second)); | 246 : static_cast<int32_t>(bytes_per_second)); |
245 } | 247 } |
246 | 248 |
247 } // namespace net | 249 } // namespace net |
OLD | NEW |