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