| 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); | |
| 199 if (!connection()->connected()) { | 198 if (!connection()->connected()) { |
| 200 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; | 199 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; |
| 201 return false; | 200 return false; |
| 202 } | 201 } |
| 203 | 202 |
| 204 if (id % 2 == 0) { | 203 if (id % 2 == 0) { |
| 205 QUIC_DLOG(INFO) << "Invalid incoming even stream_id:" << id; | 204 QUIC_DLOG(INFO) << "Invalid incoming even stream_id:" << id; |
| 206 connection()->CloseConnection( | 205 connection()->CloseConnection( |
| 207 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", | 206 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", |
| 208 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 207 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 209 return false; | 208 return false; |
| 210 } | 209 } |
| 211 return true; | 210 return true; |
| 212 } | 211 } |
| 213 | 212 |
| 214 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() { | 213 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() { |
| 215 DCHECK(!FLAGS_quic_reloadable_flag_quic_refactor_stream_creation); | |
| 216 if (!connection()->connected()) { | 214 if (!connection()->connected()) { |
| 217 QUIC_BUG << "ShouldCreateOutgoingDynamicStream called when disconnected"; | 215 QUIC_BUG << "ShouldCreateOutgoingDynamicStream called when disconnected"; |
| 218 return false; | 216 return false; |
| 219 } | 217 } |
| 220 if (!crypto_stream_->encryption_established()) { | 218 if (!crypto_stream_->encryption_established()) { |
| 221 QUIC_BUG << "Encryption not established so no outgoing stream created."; | 219 QUIC_BUG << "Encryption not established so no outgoing stream created."; |
| 222 return false; | 220 return false; |
| 223 } | 221 } |
| 224 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { | 222 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { |
| 225 VLOG(1) << "No more streams should be created. " | 223 VLOG(1) << "No more streams should be created. " |
| (...skipping 14 matching lines...) Expand all Loading... |
| 240 | 238 |
| 241 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( | 239 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( |
| 242 const QuicBandwidth& bandwidth) { | 240 const QuicBandwidth& bandwidth) { |
| 243 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); | 241 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); |
| 244 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) | 242 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) |
| 245 ? INT32_MAX | 243 ? INT32_MAX |
| 246 : static_cast<int32_t>(bytes_per_second)); | 244 : static_cast<int32_t>(bytes_per_second)); |
| 247 } | 245 } |
| 248 | 246 |
| 249 } // namespace net | 247 } // namespace net |
| OLD | NEW |