| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (!connection()->connected()) { | 186 if (!connection()->connected()) { |
| 187 LOG(DFATAL) << "ShouldCreateIncomingDynamicStream called when disconnected"; | 187 LOG(DFATAL) << "ShouldCreateIncomingDynamicStream called when disconnected"; |
| 188 return false; | 188 return false; |
| 189 } | 189 } |
| 190 | 190 |
| 191 if (id % 2 == 0) { | 191 if (id % 2 == 0) { |
| 192 DVLOG(1) << "Invalid incoming even stream_id:" << id; | 192 DVLOG(1) << "Invalid incoming even stream_id:" << id; |
| 193 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); | 193 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); |
| 194 return false; | 194 return false; |
| 195 } | 195 } |
| 196 if (!FLAGS_exact_stream_id_delta) { | |
| 197 if (GetNumOpenStreams() >= get_max_open_streams()) { | |
| 198 DVLOG(1) << "Failed to create a new incoming stream with id:" << id | |
| 199 << " Already " << GetNumOpenStreams() << " streams open (max " | |
| 200 << get_max_open_streams() << ")."; | |
| 201 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); | |
| 202 return false; | |
| 203 } | |
| 204 } | |
| 205 return true; | 196 return true; |
| 206 } | 197 } |
| 207 | 198 |
| 208 QuicDataStream* QuicServerSession::CreateIncomingDynamicStream( | 199 QuicDataStream* QuicServerSession::CreateIncomingDynamicStream( |
| 209 QuicStreamId id) { | 200 QuicStreamId id) { |
| 210 if (!ShouldCreateIncomingDynamicStream(id)) { | 201 if (!ShouldCreateIncomingDynamicStream(id)) { |
| 211 return nullptr; | 202 return nullptr; |
| 212 } | 203 } |
| 213 | 204 |
| 214 return new QuicSpdyServerStream(id, this); | 205 return new QuicSpdyServerStream(id, this); |
| 215 } | 206 } |
| 216 | 207 |
| 217 QuicDataStream* QuicServerSession::CreateOutgoingDynamicStream() { | 208 QuicDataStream* QuicServerSession::CreateOutgoingDynamicStream() { |
| 218 DLOG(ERROR) << "Server push not yet supported"; | 209 DLOG(ERROR) << "Server push not yet supported"; |
| 219 return nullptr; | 210 return nullptr; |
| 220 } | 211 } |
| 221 | 212 |
| 222 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 213 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
| 223 return crypto_stream_.get(); | 214 return crypto_stream_.get(); |
| 224 } | 215 } |
| 225 | 216 |
| 226 } // namespace tools | 217 } // namespace tools |
| 227 } // namespace net | 218 } // namespace net |
| OLD | NEW |